PHPstorm + Homestead (Vagrant) + PHPUnit

Hey guys. Just trying to get PHPUnit working with PHPStorm and Homestead. I think the config of PHPStorm is ok. I added an Remote Interpreter in the settings of PHPUnit: "Interpreter: Vagrant" "Use custom autoloader" "Path to script: /home/vagrant/Code/dev/leichti/molweight/vendor/autoload.php"

PHPInterpreter is also set remote.

When I'm now running a Test, i am getting the following output:

vagrant://C:/Users/Manuel/Homestead/usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host= /home/vagrant/.phpstorm_helpers/phpunit.php --configuration /home/vagrant/Code/dev/leichti/molweight/phpunit.xml /home/vagrant/Code/dev/leichti/molweight/tests
Testing started at 3:00 PM ...
PHP Fatal error: Uncaught Error: Class 'PHP_CodeCoverage_Filter' not found in /home/vagrant/.phpstorm_helpers/phpunit.php:325


Stack trace:
#0 /home/vagrant/Code/dev/leichti/molweight/vendor/phpunit/phpunit/src/TextUI/Command.php(123): IDE_PHPUnit_TextUI_Command->createRunner()
#1 /home/vagrant/.phpstorm_helpers/phpunit.php(299): PHPUnit_TextUI_Command->run(Array, true)
#2 /home/vagrant/.phpstorm_helpers/phpunit.php(587): IDE_Base_PHPUnit_TextUI_Command::main()

Fatal error: Uncaught Error: Class 'PHP_CodeCoverage_Filter' not found in /home/vagrant/.phpstorm_helpers/phpunit.php on line 325

#3 {main}

thrown in /home/vagrant/.phpstorm_helpers/phpunit.php on line 325
Error: Class 'PHP_CodeCoverage_Filter' not found in /home/vagrant/.phpstorm_helpers/phpunit.php on line 325

Call Stack:
0.1118 443504 1. {main}() /home/vagrant/.phpstorm_helpers/phpunit.php:0
0.2257 889632 2. IDE_Base_PHPUnit_TextUI_Command::main(???) /home/vagrant/.phpstorm_helpers/phpunit.php:587
0.2257 889744 3. PHPUnit_TextUI_Command->run(???, ???) /home/vagrant/.phpstorm_helpers/phpunit.php:299
0.2487 1106760 4. IDE_PHPUnit_TextUI_Command->createRunner() /home/vagrant/Code/dev/leichti/molweight/vendor/phpunit/phpunit/src/TextUI/Command.php:123

Process finished with exit code 255


Anyone having an idea? I have now tried to fix it for about 3 or 4 hours :-/ Very very annoying :( Thank you guys!

I am using PHPStorm 2016.1 Maybe a PHPStorm bug?


Its perfectly working when debugging locally!

1 comment

Hi there,

What is your PHPUnit versions (locally and remote ones) as well as version of phpunit/php-code-coverage?

So far it looks like . If that's your case -- you need to pin phpunit/php-code-coverage to v3.3 for now until IDE helper script will be made compatible with newer version.


Please sign in to leave a comment.