Using VVV PHPUnit WP tests from PHPStorm

I'm using VVV so I can have a convenient and capable wordpress plugin development environment.

The only thing I still can't get working is running tests directly from PhpStorm, and I can't figure out why, since it works perfectly when running it from the terminal.

Someone had a similar issue on github, however it's 4 years old: https://github.com/Varying-Vagrant-Vagrants/VVV/issues/254

I read this post (commented on the github issue) and I tried following, however still no luck.

Here's the return when I try to run it from the PhpStorm Run dialog:

ssh://vagrant@192.168.50.4:22/usr/bin/php /usr/local/src/composer/vendor/phpunit/phpunit/phpunit --configuration /vagrant/www/test/public_html/wp-content/plugins/test-plugin/phpunit.xml.dist --teamcity
Could not find /tmp/wordpress-tests-lib/includes/functions.php, have you run bin/install-wp-tests.sh ?

Process finished with exit code 1

Using vagrant ssh, navigating to the directory of the plugin and running phpunit works as intended: The tests starts to run, then it gives the report.

 

Does anyone had any success with it?

 

Current stats:
Windows 10 Home 1803
PhpStorm 2018.2
VVV 2.2.2 develop branch

 

0
Avatar
Permanently deleted user

Hello,

What is the command that you run in Terminal to get the tests run successfully?

Did you try to execute the command PhpStorm runs?

What are remote CLI interpreter and PHPUnit configurations?

0

Thank you for the reply, Vladimir, it's really appreciated!

 

What is the command that you run in Terminal to get the tests run successfully?

After vagrant up, I use vagrant ssh, then cd /vagrant/www/... until I'm in the plugin folder. After that, it's just phpunit and the tests works just fine. I usually do this though the phpstorm terminal window.

 

Here are pictures of how it's configured:

 

Testing started at 10:45 ...
vagrant://C:/Users/henri/Documents/Trabalhos/dev/usr/bin/php /usr/local/src/composer/vendor/phpunit/phpunit/phpunit --configuration /srv/www/rbc-reservas/public_html/wp-content/plugins/reservas/phpunit.xml.dist --teamcity
Could not find /tmp/wordpress-tests-lib/includes/functions.php, have you run bin/install-wp-tests.sh ?

Process finished with exit code 1
0

Please run phpunit -vvv in VVV via Terminal and show us the output, I suspect there's a Bootstrap file you haven't set up in PhpStorm.

0

Thank you for the reply, Eugene.

You mean, running phpunit -vvv via SSH also?  

If so, here's the output:

 

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 6.5.9 by Sebastian Bergmann and contributors.

Runtime: PHP 7.2.8-1+ubuntu14.04.1+deb.sury.org+1
Configuration: /vagrant/www/rbc-reservas/public_html/wp-content/plugins/reservas/phpunit.xml.dist

.. 2 / 2 (100%)

Time: 10.03 seconds, Memory: 24.00MB

OK (2 tests, 4 assertions)
0

Yes, thank you, that's what I meant, although it didn't help much. What if you run this command via SSH, it won't run it as well, will it?
/usr/bin/php /usr/local/src/composer/vendor/phpunit/phpunit/phpunit --configuration /srv/www/rbc-reservas/public_html/wp-content/plugins/reservas/phpunit.xml.dist

0

Thank you for the reply!  

  

It actually worked out perfectly!

 

Seems to me that PhpStorm run command is trying to run the command from windows, not from the vagrant machine. I'm not sure tho, I'm new to Vagrant and also PhpStorm.

0

请先登录再写评论。