Skip to content

Instantly share code, notes, and snippets.

@n3r0-ch
Created June 24, 2018 20:45
Show Gist options
  • Save n3r0-ch/8903de658c29c0a1e524f1b383852263 to your computer and use it in GitHub Desktop.
Save n3r0-ch/8903de658c29c0a1e524f1b383852263 to your computer and use it in GitHub Desktop.
Symfony PHPUnit pain in the ass
vagrant@ipnf:/vagrant$ composer req phpunit/phpunit
Using version ^7.2 for phpunit/phpunit
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Prefetching 26 packages 🎶
- Downloading (100%)
Package operations: 26 installs, 0 updates, 0 removals
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/resource-operations (1.0.0): Loading from cache
- Installing sebastian/recursion-context (3.0.0): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Installing sebastian/object-enumerator (3.0.3): Loading from cache
- Installing sebastian/global-state (2.0.0): Loading from cache
- Installing sebastian/exporter (3.1.0): Loading from cache
- Installing sebastian/environment (3.1.0): Loading from cache
- Installing sebastian/diff (3.0.1): Loading from cache
- Installing sebastian/comparator (3.0.1): Loading from cache
- Installing phpunit/php-timer (2.0.0): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/php-file-iterator (2.0.1): Loading from cache
- Installing theseer/tokenizer (1.1.0): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
- Installing phpunit/php-token-stream (3.0.0): Loading from cache
- Installing phpunit/php-code-coverage (6.0.7): Loading from cache
- Installing webmozart/assert (1.3.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
- Installing phpspec/prophecy (1.7.6): Loading from cache
- Installing phar-io/version (1.0.1): Loading from cache
- Installing phar-io/manifest (1.0.1): Loading from cache
- Installing myclabs/deep-copy (1.8.1): Loading from cache
- Installing phpunit/phpunit (7.2.6): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe (c8a81b0823e4f63ff6d4737034538f00)
- Configuring phpunit/phpunit (>=4.7): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.
Adding phpunit/phpunit as a dependency is discouraged in favor of Symfony's PHPUnit Bridge.
* Instead:
1. Remove it now: composer remove --dev phpunit/phpunit
2. Use Symfony's bridge: composer require --dev phpunit
vagrant@ipnf:/vagrant$ composer remove phpunit/phpunit && composer require phpunit
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 26 removals
- Removing webmozart/assert (1.3.0)
- Removing theseer/tokenizer (1.1.0)
- Removing sebastian/version (2.0.1)
- Removing sebastian/resource-operations (1.0.0)
- Removing sebastian/recursion-context (3.0.0)
- Removing sebastian/object-reflector (1.1.1)
- Removing sebastian/object-enumerator (3.0.3)
- Removing sebastian/global-state (2.0.0)
- Removing sebastian/exporter (3.1.0)
- Removing sebastian/environment (3.1.0)
- Removing sebastian/diff (3.0.1)
- Removing sebastian/comparator (3.0.1)
- Removing sebastian/code-unit-reverse-lookup (1.0.1)
- Removing phpunit/phpunit (7.2.6)
- Removing phpunit/php-token-stream (3.0.0)
- Removing phpunit/php-timer (2.0.0)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (2.0.1)
- Removing phpunit/php-code-coverage (6.0.7)
- Removing phpspec/prophecy (1.7.6)
- Removing phpdocumentor/type-resolver (0.4.0)
- Removing phpdocumentor/reflection-docblock (4.3.0)
- Removing phpdocumentor/reflection-common (1.0.1)
- Removing phar-io/version (1.0.1)
- Removing phar-io/manifest (1.0.1)
- Removing myclabs/deep-copy (1.8.1)
Writing lock file
Generating autoload files
Symfony operations: 1 recipe (58f290631f288db6f65e27a96f526624)
- Unconfiguring phpunit/phpunit (>=4.7): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Using version ^1.0 for symfony/test-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Prefetching 5 packages 🎶
- Downloading (100%)
Package operations: 5 installs, 0 updates, 0 removals
- Installing symfony/phpunit-bridge (v4.1.0): Loading from cache
- Installing symfony/css-selector (v4.1.0): Loading from cache
- Installing symfony/dom-crawler (v4.1.0): Loading from cache
- Installing symfony/browser-kit (v4.1.0): Loading from cache
- Installing symfony/test-pack (v1.0.2): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe (dd170f15dfc4f0b19e196dd09368640a)
- Configuring symfony/phpunit-bridge (>=4.1): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.
How to test?
* Write test cases in the tests/ folder
* Run php bin/phpunit
vagrant@ipnf:/vagrant$ make test
php bin/console cache:clear --no-warmup --env=test
// Clearing the cache for the test environment with debug
// true
[OK] Cache for the "test" environment (debug=true) was successfully cleared.
php bin/console cache:warmup --env=test
// Warming up the cache for the test environment with debug
// true
[OK] Cache for the "test" environment (debug=true) was successfully warmed.
php bin/phpunit --verbose
#!/usr/bin/env php
PHP Fatal error: Uncaught Exception: simple-phpunit requires the "zip" PHP extension to be installed and enabled in order to uncompress the downloaded PHPUnit packages. in /vagrant/vendor/symfony/phpunit-bridge/bin/simple-phpunit:107
Stack trace:
#0 /vagrant/bin/phpunit(18): require()
#1 {main}
thrown in /vagrant/vendor/symfony/phpunit-bridge/bin/simple-phpunit on line 107
make: *** [test] Error 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment