3

Trying to setup remote Codeception Unit Tests in PhpStorm in a Yii2 project.

Using SSH I can log into the server go to the root directory of my Yii2 project and run :

> vendor/bin/codecept run unit

and the tests run.

I'm trying run these remote tests via PhpStorm, I've setup a Remote PHP CLI interpreter and I'm pointing to the Codeception library in my Yii2 project folder:

/var/www/vhosts/mydomain.com/httpdocs/yii2/vendor/bin/codecept

Test Runner points to:

/var/www/vhosts/mydomain.com/httpdocs/yii2/codeception.yml

Trying to run the tests the following command is executed:

> ssh://[email protected]:22/opt/plesk/php/5.6/bin/php /root/.phpstorm_helpers/phpunit.php --no-configuration /var/www/vhosts/mydomain.com/httpdocs/yii2/tests

The process fails at it complains that it cannot find PHPUnit:

Process finished with exit code 1
Cannot find PHPUnit in include path (.:/opt/plesk/php/5.6/share/pear)

How do I get PhpStorm to look for PHPUnit in the yii2/vendor folder? Can I just tell PhpStorm to run a different command instead of this phpstorm_helpers? It seems that the documentation is out of date and the screenshots JetBrains provides are from a different version of PhpStorm, I'm running PhpStorm 2017.3

5
  • have you installed php-unit, dont use pear-packages they are deprecated Commented Mar 23, 2018 at 19:27
  • PHPUnit is installed as part of Yii2 Codeception, I don't know why PHPStorm is looking for a pear package. Again its not an issue when running the tests via SSH. PHPUnit is in /var/www/vhosts/mydomain.com/httpdocs/yii2/vendor/bin/phpunit Commented Mar 23, 2018 at 20:10
  • 1
    hmm, try this one, go to Languages and Frameworks in the PhpStorm settings. If you click on PHP, on the right you have your include paths, there you should provide the path to the PHPUnit which is vendor/phpunit/phpunit. try it and tell if it works out for you Commented Mar 23, 2018 at 20:14
  • it should be vendor/bin/phpunit i just saw the path you specified. Commented Mar 23, 2018 at 22:26
  • the include paths seem to be local paths?? Commented Mar 25, 2018 at 3:38

1 Answer 1

1

So after a LOT of digging, the issue was with the Run/Debug Configuration. Despite adding Codeception to the Test Frameworks section, clicking the run button still tried to execute a pure PHPUnit test.

To switch to run the test as Codeception, look at the top toolbar above the file tabs: Edit Run/Debug Configuration

There you will be able to define various options:

Configuration Dialog

Now under run you'll have additional options:

Run Menu

Choose the blue Codeception icon to run the test using Codeception instead of PHPUnit

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.