composer show dev packages and non dev packages - php

Is there any way to know what packages will/will not be autoloaded when using the --no-dev flag?
I have inherited some code that uses composer and Im unsure what packages are included in the production build and what are only included in the dev build.
Since doing composer dump-autoload --no-dev gives me errors regarding missing classes I suspect that some packages are flagged as dev-only when they should not and I'm trying to track those down.
I havent found anything in the composer docs to help me doing this.

The easiest way to check which packages are dev-only is to run composer install (this will install all dependencies, including dev-only) and then composer install --no-dev (this will remove dev-only dependencies). Last command will give you list of removed dependencies - these are packages not available in production builds, you should not rely on them (or move them to require section in your composer.json).
Example:
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 56 installs, 0 updates, 0 removals
- Installing yiisoft/yii2-composer (2.0.7): Loading from cache
- Installing bower-asset/jquery (3.3.1): Loading from cache
- Installing bower-asset/bootstrap (v3.4.1): Loading from cache
- Installing bower-asset/inputmask (3.3.11): Loading from cache
- Installing bower-asset/punycode (v1.3.2): Loading from cache
- Installing bower-asset/yii2-pjax (2.0.7.1): Loading from cache
- Installing cebe/markdown (1.2.1): Loading from cache
- Installing ezyang/htmlpurifier (v4.10.0): Loading from cache
- Installing yiisoft/yii2 (2.0.17): Loading from cache
- Installing swiftmailer/swiftmailer (v5.4.12): Loading from cache
- Installing yiisoft/yii2-swiftmailer (2.0.7): Loading from cache
- Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
- Installing symfony/yaml (v2.8.49): Loading from cache
- Installing symfony/finder (v2.8.49): Loading from cache
- Installing symfony/event-dispatcher (v2.8.49): Loading from cache
- Installing symfony/polyfill-mbstring (v1.11.0): Loading from cache
- Installing symfony/dom-crawler (v2.8.49): Loading from cache
- Installing symfony/css-selector (v2.8.49): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v2.8.49): Loading from cache
- Installing symfony/console (v2.8.49): Loading from cache
- Installing symfony/browser-kit (v2.8.49): Loading from cache
- Installing ralouphie/getallheaders (2.0.5): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing guzzlehttp/psr7 (1.5.2): Loading from cache
- Installing sebastian/recursion-context (1.0.5): Loading from cache
- Installing sebastian/exporter (1.2.2): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing doctrine/instantiator (1.0.5): Loading from cache
- Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
- Installing codeception/stub (1.0.4): Loading from cache
- Installing sebastian/diff (1.4.3): Loading from cache
- Installing sebastian/comparator (1.2.4): Loading from cache
- Installing sebastian/version (1.0.6): Loading from cache
- Installing sebastian/global-state (1.1.1): Loading from cache
- Installing sebastian/environment (1.3.8): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing phpunit/php-token-stream (1.4.12): Loading from cache
- Installing phpunit/php-code-coverage (2.2.4): Loading from cache
- Installing phpdocumentor/reflection-docblock (2.0.5): Loading from cache
- Installing phpspec/prophecy (1.8.0): Loading from cache
- Installing phpunit/phpunit (4.8.36): Loading from cache
- Installing codeception/phpunit-wrapper (6.0.10): Loading from cache
- Installing behat/gherkin (v4.6.0): Loading from cache
- Installing codeception/base (2.4.1): Loading from cache
- Installing myclabs/deep-copy (1.6.1): Loading from cache
- Installing codeception/specify (0.4.6): Loading from cache
- Installing codeception/verify (0.3.3): Loading from cache
- Installing yiisoft/yii2-bootstrap (2.0.9): Loading from cache
- Installing yiisoft/yii2-debug (2.0.14): Loading from cache
- Installing fzaninotto/faker (v1.8.0): Loading from cache
- Installing yiisoft/yii2-faker (2.0.4): Loading from cache
- Installing phpspec/php-diff (v1.1.0): Loading from cache
- Installing bower-asset/typeahead.js (v0.11.1): Loading from cache
- Installing yiisoft/yii2-gii (2.0.8): Loading from cache
Generating autoload files
And then list of dev-only dependencies:
$ composer install --no-dev
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 44 removals
- Removing yiisoft/yii2-gii (2.0.8)
- Removing yiisoft/yii2-faker (2.0.4)
- Removing yiisoft/yii2-debug (2.0.14)
- Removing symfony/yaml (v2.8.49)
- Removing symfony/polyfill-mbstring (v1.11.0)
- Removing symfony/polyfill-ctype (v1.11.0)
- Removing symfony/finder (v2.8.49)
- Removing symfony/event-dispatcher (v2.8.49)
- Removing symfony/dom-crawler (v2.8.49)
- Removing symfony/debug (v2.8.49)
- Removing symfony/css-selector (v2.8.49)
- Removing symfony/console (v2.8.49)
- Removing symfony/browser-kit (v2.8.49)
- Removing sebastian/version (1.0.6)
- Removing sebastian/recursion-context (1.0.5)
- Removing sebastian/global-state (1.1.1)
- Removing sebastian/exporter (1.2.2)
- Removing sebastian/environment (1.3.8)
- Removing sebastian/diff (1.4.3)
- Removing sebastian/comparator (1.2.4)
- Removing ralouphie/getallheaders (2.0.5)
- Removing psr/log (1.1.0)
- Removing psr/http-message (1.0.1)
- Removing phpunit/phpunit-mock-objects (2.3.8)
- Removing phpunit/phpunit (4.8.36)
- Removing phpunit/php-token-stream (1.4.12)
- Removing phpunit/php-timer (1.0.9)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (1.4.5)
- Removing phpunit/php-code-coverage (2.2.4)
- Removing phpspec/prophecy (1.8.0)
- Removing phpspec/php-diff (v1.1.0)
- Removing phpdocumentor/reflection-docblock (2.0.5)
- Removing myclabs/deep-copy (1.6.1)
- Removing guzzlehttp/psr7 (1.5.2)
- Removing fzaninotto/faker (v1.8.0)
- Removing doctrine/instantiator (1.0.5)
- Removing codeception/verify (0.3.3)
- Removing codeception/stub (1.0.4)
- Removing codeception/specify (0.4.6)
- Removing codeception/phpunit-wrapper (6.0.10)
- Removing codeception/base (2.4.1)
- Removing bower-asset/typeahead.js (v0.11.1)
- Removing behat/gherkin (v4.6.0)
Generating autoload files
There is also a maglnet/composer-require-checker which may be useful for detecting usage of libraries not listed in require section.

Basically, any package (and its dependencies) in require-dev section of your composer.json file will not be autoloaded when you use composer dump-autoload --no-dev. Sadly, I don't think there's a command to show those packages together with their dependencies as a single list.
What you can do is try moving each of the packages from require-dev section to require, reruning composer update and composer dump-autoload --no-dev to see when your error disappears.

I just discovered that you can show all root packages using composer show -s:
name : roots/bedrock
descrip. : WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure
keywords : bedrock, roots, wordpress, stack, composer, vagrant, wp
versions : * dev-update-and-apply-aq-changes
type : project
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : https://roots.io/bedrock/
source : [] 412b5d6779300e49762ed2402d0f87ca50475f2f
dist : [] 412b5d6779300e49762ed2402d0f87ca50475f2f
path :
names : roots/bedrock
support
issues : https://github.com/roots/bedrock/issues
forum : https://discourse.roots.io/category/bedrock
requires
php >=7.0
composer/installers ^1.11
oscarotero/env ^1.2.0
roots/wordpress 5.7.2
roots/wp-password-bcrypt 1.0.0
roots/wp-config 1.0.0
advanced-custom-fields/advanced-custom-fields-pro *
wpackagist-plugin/wordpress-seo ^16.1
requires (dev)
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can cut out the requires (dev) section using composer show -s | sed -n '/requires (dev)$/,/^$/p'
requires (dev)
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can get rid of the title using composer show -s | sed -n '/requires (dev)$/,/^$/p' | grep -v 'requires (dev)'
squizlabs/php_codesniffer ^3.0.2
dealerdirect/phpcodesniffer-composer-installer *
wp-coding-standards/wpcs *
wpackagist-plugin/query-monitor ^3.7
roave/security-advisories dev-master
And then you can get rid of the version using composer show -s | sed -n '/requires (dev)$/,/^$/p' | grep -v 'requires (dev)' | cut -d ' ' -f1
squizlabs/php_codesniffer
dealerdirect/phpcodesniffer-composer-installer
wp-coding-standards/wpcs
wpackagist-plugin/query-monitor
roave/security-advisories

Related

How do I fix a missing script in Laravel/Composer Setup?

I am trying to setup Laravel which was working before but it stopped running.
I have installed Composer through the newest installer and installed Laravel through Composer with :
composer global require laravel/installer
Afterwards I try to create a new project and the creation stops at this point
Those are the versions of everything:
C:\Users\josep\Desktop>php -v
PHP 7.4.1 (cli) (built: Dec 17 2019 19:23:59) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
C:\Users\josep\Desktop>composer -V
Composer version 1.9.1 2019-11-01 17:20:17
C:\Users\josep\Desktop>laravel -v
Laravel Installer 3.0.1
I have tested Uninstalling everything and reinstalling everything but nothing works.
C:\Users\josep\Desktop>laravel new finalproject
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 14 installs, 0 updates, 0 removals
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing ralouphie/getallheaders (3.0.3): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing guzzlehttp/psr7 (1.6.1): Loading from cache
- Installing symfony/process (v5.0.2): Loading from cache
- Installing symfony/polyfill-ctype (v1.13.1): Loading from cache
- Installing symfony/filesystem (v5.0.2): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/service-contracts (v2.0.1): Loading from cache
- Installing symfony/polyfill-php73 (v1.13.1): Loading from cache
- Installing symfony/polyfill-mbstring (v1.13.1): Loading from cache
- Installing symfony/console (v5.0.2): Loading from cache
- Installing guzzlehttp/guzzle (6.5.2): Loading from cache
- Installing laravel/installer (v3.0.1): Loading from cache
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing psr/log (For using the console logger)
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
guzzlehttp/guzzle suggests installing ext-intl (Required for Internationalized Domain Name (IDN) support)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Generating autoload files
[InvalidArgumentException]
Script "post-root-package-install" is not defined in this package
run-script [--timeout TIMEOUT] [--dev] [--no-dev] [-l|--list] [--] [<script>] [<args>]...

Can't create Symfony 4 projects

i'm working already with symfony 3, I've create a lot of project with it, so now i'm trying to create a project with symfony 4, but i can't when i type this command :
composer create-project symfony/skeleton my-project-symf-4
the project is created successfully, but the problem that is created with this version 3.4 instead of 4.2,
Installing symfony/skeleton (v3.4.22.1)
- Installing symfony/skeleton (v3.4.22.1): Downloading (100%)
Created project in my-project-symf-4
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 22 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.1.8): Downloading (100%)
Prefetching 21 packages
- Downloading (100%)
- Installing psr/cache (1.0.1): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v3.4.22): Loading from cache
- Installing symfony/console (v3.4.22): Loading from cache
- Installing symfony/dotenv (v3.4.22): Loading from cache
- Installing symfony/routing (v3.4.22): Loading from cache
- Installing symfony/http-foundation (v3.4.22): Loading from cache
- Installing symfony/event-dispatcher (v3.4.22): Loading from cache
- Installing symfony/http-kernel (v3.4.22): Loading from cache
- Installing symfony/finder (v3.4.22): Loading from cache
- Installing symfony/filesystem (v3.4.22): Loading from cache
- Installing symfony/dependency-injection (v3.4.22): Loading from cache
- Installing symfony/config (v3.4.22): Loading from cache
- Installing symfony/class-loader (v3.4.22): Loading from cache
- Installing symfony/polyfill-apcu (v1.10.0): Loading from cache
- Installing symfony/cache (v3.4.22): Loading from cache
- Installing symfony/framework-bundle (v3.4.22): Loading from cache
- Installing symfony/yaml (v3.4.22): Loading from cache
Generating autoload files
So as you can see the composer load all packages from cache.
I've try to clear composer cache like this:
$ composer clearcache
but without result, the problem still exist.
My PHP Version is 7.3.1
Can anyone help me to resolve that problem?
Try to pass the symfony version (4.2 for example) like that:
composer create-project symfony/skeleton:4.2 my-project-symf-4
Hope this helps!
If you installed symfony CLI in your system then you just run the below command with specifying version number
For Example to create a Symfony project with 4.4 version run following command
symfony new my_project_name --version=4.4

Is there a way to limit a vendor's package version requirements

I'm using the acelaya/zf2-acqrcode package (v0.2.0) It requires "endroid/qrcode": ">=1.2.0", (meaning everything higher than or equal to 1.2.0)
Currently the latest version of the "endroid/qrcode" package = v3.2.12
The acelaya/zf2-acqrcode package (v0.2.0) uses a function that doesn't exist anymore in endroid/qrcode versions > 1.9.3
Is there any way I can tell composer not to install a version of the endroid/qrcode package higher than 1.9.3?
Yes you can restrict the package versions by using the ~ operator in composer.json. More Information on that can be found Here
Hope this helps.
Use the following to lock the endroid/qrcode dependency to 1.9.3. Sub dependencies will adhere to this and honour the fact you've locked acelaya/zf2-acqrcode.
Note: this will only fail when another dependency requires >1.9.3 of endroid/qrcode
{
"require": {
"endroid/qrcode": "1.9.3",
"acelaya/zf2-acqrcode": "^1.0"
}
}
Run the command following command:
/path/to/composer.phar require endroid/qrcode:1.9.3
Here's the output of the above required dependencies:
$ composer install
Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 18 installs, 0 updates, 0 removals
- Installing zendframework/zend-stdlib (3.2.0): Loading from cache
- Installing zendframework/zend-loader (2.6.0): Loading from cache
- Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
- Installing zendframework/zend-view (2.10.0): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing container-interop/container-interop (1.2.0): Loading from cache
- Installing zendframework/zend-servicemanager (3.3.2): Loading from cache
- Installing zendframework/zend-validator (2.10.2): Loading from cache
- Installing zendframework/zend-escaper (2.6.0): Loading from cache
- Installing zendframework/zend-uri (2.6.1): Loading from cache
- Installing zendframework/zend-http (2.8.0): Loading from cache
- Installing zendframework/zend-router (3.0.2): Loading from cache
- Installing zendframework/zend-config (3.2.0): Loading from cache
- Installing zendframework/zend-modulemanager (2.8.2): Loading from cache
- Installing zendframework/zend-mvc (3.1.1): Loading from cache
- Installing symfony/options-resolver (v3.4.11): Loading from cache
- Installing endroid/qrcode (1.9.3): Loading from cache
- Installing acelaya/zf2-acqrcode (v1.0.0): Loading from cache

Symfony 4 install there is no "public" folder.Just "vendor/".(Could not open input file: bin/console)

I want to learn Symfony Framework but i can't run it.Composer latest version.And i use this command to install framework as Docs said.Than i use this command for start the server in "project/" folder but i get that error "Could not open input file: bin/console".
duhan#dbalci:/var/www$ composer create-project symfony/skeleton project
Installing symfony/skeleton (v4.0.5)
- Installing symfony/skeleton (v4.0.5): Loading from cache
Created project in project
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 21 installs, 0 updates, 0 removals
- Installing symfony/flex (v1.0.78): Loading from cache
- Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
- Installing symfony/console (v4.0.8): Loading from cache
- Installing symfony/routing (v4.0.8): Loading from cache
- Installing symfony/http-foundation (v4.0.8): Loading from cache
- Installing symfony/yaml (v4.0.8): Loading from cache
- Installing symfony/framework-bundle (v4.0.8): Loading from cache
- Installing symfony/http-kernel (v4.0.8): Loading from cache
- Installing symfony/event-dispatcher (v4.0.8): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v4.0.8): Loading from cache
- Installing symfony/finder (v4.0.8): Loading from cache
- Installing symfony/filesystem (v4.0.8): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/dependency-injection (v4.0.8): Loading from cache
- Installing symfony/config (v4.0.8): Loading from cache
- Installing psr/simple-cache (1.0.1): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/cache (v4.0.8): Loading from cache
- Installing symfony/dotenv (v4.0.8): Loading from cache
Writing lock file
Generating autoload files
duhan#dbalci:/var/www$ cd project/
duhan#dbalci:/var/www/project$ php bin/console server:run
Could not open input file: bin/console
There is just "vendor/" folder but i seen in tutorials there is more.
"ls -l" output :
duhan#dbalci:/var/www/project$ ls -l
total 60
-rw-rw-r-- 1 duhan duhan 1231 Apr 13 13:30 composer.json
-rw-rw-r-- 1 duhan duhan 48230 Apr 13 13:30 composer.lock
-rw-rw-r-- 1 duhan duhan 3 Apr 13 13:30 symfony.lock
drwxrwxr-x 5 duhan duhan 4096 Apr 13 13:30 vendor
It seems like Composer hasn't fully executed the functionality in the symfony/flex plugin. The only reason I can think of that would cause this is if you've got plugins disabled globally (you can diagnose this by running composer config -l and seeing if it mentions no-plugins anywhere)
I can replicate your directory structure by running:
composer create-project symfony/skeleton project --no-plugins
cd project
composer install
This will create an empty symfony.lock file, but not unpack any of the installed Symfony recipes.
From here, you should be able to complete the installation by running
composer fix-recipes
in the project folder. This will finish unpacking all of the installed recipes, including creating the missing directory structure.

PHPUnit compare xml string with xml file failed in PHP 5.6, but pass in PHP 7.0

I use the travis-ci to run my tests. In my local computer I checked the two PHP version, and it is good. But in Travis the tests under 5.6 PHP version failed. But tests are passed in PHP 7.0 version. I do not know what is the real problem.
$client = static::createClient();
$crawler = $client->request('GET', '/sitemap.xml');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertXmlStringEqualsXmlFile(
__DIR__ . '/../Resources/sample.xml',
$client->getResponse()->getContent()
);
I have a sample.xml which contains the correct XML structure with values.
I generate the sitemap.xml via /sitemap.xml link.
I always get error: The two DOM does not equal.
PHPUnit version is 5.1.3 on my computer.
Here the log file of Travis-ci:
$ php --version
PHP 5.6.5 (cli) (built: Feb 12 2015 01:41:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans
$ composer --version
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Composer version 1.2-dev (32a8a60695b9b9c9e2da01406ac3713903182669) 2016-05-17 13:08:17
before_install.1
0.00s$ if [[ ! $PHP = ${MIN_PHP%.*} && $TRAVIS_PULL_REQUEST != false ]]; then skip=1; fi
before_install.2
2.11s$ composer self-update --stable;
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Updating to version 1.1.1 (stable channel).
Downloading: Connecting... Downloading: 100%
Use composer self-update --rollback to return to version 32a8a60695b9b9c9e2da01406ac3713903182669
before_install.3
0.00s$ if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi
install
60.18s$ if [ ! $skip ]; then composer update --prefer-dist; fi
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing psr/log (1.0.0)
Loading from cache
- Installing doctrine/lexer (v1.0.1)
Loading from cache
- Installing doctrine/annotations (v1.2.7)
Loading from cache
- Installing doctrine/collections (v1.3.0)
Loading from cache
- Installing doctrine/cache (v1.6.0)
Loading from cache
- Installing doctrine/inflector (v1.1.0)
Loading from cache
- Installing doctrine/common (v2.6.1)
Loading from cache
- Installing symfony/polyfill-util (v1.1.1)
Loading from cache
- Installing paragonie/random_compat (v1.4.1)
Loading from cache
- Installing symfony/polyfill-php70 (v1.1.1)
Loading from cache
- Installing symfony/polyfill-php56 (v1.1.1)
Loading from cache
- Installing symfony/polyfill-mbstring (v1.1.1)
Loading from cache
- Installing symfony/symfony (v3.0.6)
Loading from cache
- Installing symfony/polyfill-intl-icu (v1.1.1)
Loading from cache
- Installing twig/twig (v1.24.0)
Loading from cache
- Installing sensio/framework-extra-bundle (v3.0.16)
Loading from cache
- Installing doctrine/instantiator (1.0.5)
Loading from cache
- Installing doctrine/dbal (v2.5.4)
Loading from cache
- Installing doctrine/orm (v2.5.4)
Loading from cache
- Installing doctrine/doctrine-cache-bundle (1.3.0)
Loading from cache
- Installing jdorn/sql-formatter (v1.2.17)
Loading from cache
- Installing doctrine/doctrine-bundle (1.6.2)
Loading from cache
- Installing myclabs/deep-copy (1.5.1)
Loading from cache
- Installing sebastian/version (1.0.6)
Loading from cache
- Installing sebastian/resource-operations (1.0.0)
Loading from cache
- Installing sebastian/global-state (1.1.1)
Loading from cache
- Installing sebastian/recursion-context (1.0.2)
Loading from cache
- Installing sebastian/exporter (1.2.1)
Loading from cache
- Installing sebastian/environment (1.3.7)
Loading from cache
- Installing sebastian/diff (1.4.1)
Loading from cache
- Installing sebastian/comparator (1.2.0)
Loading from cache
- Installing phpdocumentor/reflection-docblock (2.0.4)
Loading from cache
- Installing phpspec/prophecy (v1.6.0)
Loading from cache
- Installing phpunit/php-text-template (1.2.1)
Loading from cache
- Installing phpunit/phpunit-mock-objects (3.1.3)
Loading from cache
- Installing phpunit/php-timer (1.0.8)
Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.0)
Loading from cache
- Installing phpunit/php-token-stream (1.4.8)
Loading from cache
- Installing phpunit/php-file-iterator (1.4.1)
Loading from cache
- Installing phpunit/php-code-coverage (3.3.1)
Loading from cache
- Installing phpunit/phpunit (5.1.7)
Loading from cache
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
sensio/framework-extra-bundle suggests installing symfony/psr-http-message-bridge (To use the PSR-7 converters)
doctrine/doctrine-cache-bundle suggests installing symfony/security-acl (For using this bundle to cache ACLs)
sebastian/global-state suggests installing ext-uopz (*)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Generating autoload files
1.10s$ phpunit Tests/;
PHPUnit 5.1.7 by Sebastian Bergmann and contributors.
F.... 5 / 5 (100%)
Time: 973 ms, Memory: 28.25MB
There was 1 failure:
1) RepoSitemapBundle\Tests\Controller\DefaultControllerTest::testSitemapAction
Failed asserting that two DOM documents are equal.
--- Expected
+++ Actual
## ##
<?xml version="1.0"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9">
- <url>
- <loc>http://www.localhosttest/1</loc>
- <lastmod>2010-01-01</lastmod>
- <changefreq>daily</changefreq>
- <priority>0.9</priority>
- </url>
-</urlset>
+ <url>
+ <loc>http://www.localhosttest/1</loc>
+ <lastmod>2010-01-01</lastmod>
+ <changefreq>daily</changefreq>
+ <priority>0.9</priority>
+ </url>
+ </urlset>
/home/travis/build/botalaszlo/tmp-sitemap-bundle/Tests/Controller/DefaultControllerTest.php:37
phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:152
phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:104
FAILURES!
Tests: 5, Assertions: 10, Failures: 1.
The command "phpunit Tests/;" exited with 1.
But in PHP 7.0 this is not failed.
I have tried to load with SimpleXml the sample.xml file, but I had the same problem.
Short solution does not run tests in PHP 5.6
That is because the string from your output and the string in your file contains spaces and new lines that are not equal to each other.
If you use phpstorm and run your unittest in there. You could see the differences and compare them. Phpstorm will show you a diff window by clicking on the assert error message in the console.

Categories