When I run vendor/bin/phpunit
my tests all run successfully. However, when I right click on a tests file and click "Run tests" I end up seeing:
/usr/local/bin/php -dxdebug.coverage_enable=1 /private/var/folders/bj/t2w187x158g7rgghctgknwb80000gn/T/ide-phpunit.php --coverage-clover /Users/bkuhl/Library/Caches/WebIde70/coverage/services$tests.coverage --no-configuration /Users/bkuhl/Projects/myproject/services/app/tests
Testing started at 3:09 PM ...
Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /private/var/folders/bj/t2w187x158g7rgghctgknwb80000gn/T/ide-phpunit.php on line 504
PHP Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /private/var/folders/bj/t2w187x158g7rgghctgknwb80000gn/T/ide-phpunit.php on line 504
Call Stack:
0.0008 340040 1. {main}() /private/var/folders/bj/t2w187x158g7rgghctgknwb80000gn/T/ide-phpunit.php:0
PHP Stack trace:
PHP 1. {main}() /private/var/folders/bj/t2w187x158g7rgghctgknwb80000gn/T/ide-phpunit.php:0
Process finished with exit code 255
I have PHPStorm configured to use path/to/vendor/autoload.php
I've temporarily changed the path of this directory for the purpose of this screenshot, but it is a perfectly valid path.
Has anyone run into issues using PHPStorm's ability to run your tests?
composer.json:
"require-dev": {
"way/generators": "dev-master",
"way/laravel-test-helpers": "dev-master",
"mockery/mockery": "*",
"codeception/aspect-mock": "*",
"phpunit/phpunit": "3.9.*@dev"
},
PhpStorm uses wrapper/helper script when executing PHPUnit tests (for integration purposes: monitor execution progress, stack trace etc).
At the moment that helper script does not support PHPUnit 3.8 or 3.9 -- only 3.7 and below.
Corresponding ticket: http://youtrack.jetbrains.com/issue/WI-21666 -- watch it (star/vote/comment) to get notified when it will be resolved.
PS
This issue is now fixed and fix will be available in next public EAP build (newer than current 134.1456).
Another solution: Set
"phpunit/phpunit": "3.7"
in composer.json
and run
composer update
Then the issue will be resolved.
this worked for me also...
Some user named andriy komm added solution based on manual fixing of php plugin in IDE in ticket thread ( http://youtrack.jetbrains.com/issue/WI-21666 ):
A workaround until it is fixed:
go to /plugins/php/lib
make a backup of php.jar
Use whatever tool you have to open the file, usually zip or other compress tools or under ubuntu the file roller.
Go to scripts/phpunit.php
Modify it, searching for the "IDE_PHPUnit_Framework_TestListener" class and adding there the following line:
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {} 6. save the file and update the php.jar
Note 1: depending on OS and tool you use, you might have to unpack the .jar to modify and compress it back to jar again. Using file roller on ubuntu I could skip this step, edit the file and update the jar directly.
Editing the /tmp/ide-phpunit.php DOES not help, because it get overriden by the phpunit.php file, which I mentioned above.
Note 2: Also depending on the version, you might find the php.jar elsewhere:
Either here: Go to your users home directory (windows/linux) and search vor a hidden directory .Webide, while is a number depending on your phpstorm version (e. G. .Webide70)
Or here: I think earlier versions were named like .IntelliJIdea while is a number depending on your phpstorm version.
And there use the same path (/plugins/php/lib)
Worked for me (Windows 7, PHPStorm 7, #PS-133.982).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.