0
votes

Question: How do I setup codecetion tests in phpStorm 9 for the yii2-advanced-template?

Codeception is setup properly and when I go to the /tests/ folder and run codecept run then everything works perfectly fine, and all tests are executed.

But I can't get it to run in phpStom:

Under Settings->Language and Frameworks->PHP->PHPUnit I have set: .) custom autoloader pointing to the autoload.php under vendor .) no default config .) no bootstrap file

And in Run/Debug Configuration I have used the Dictionary option with the /tests/ folder.

When I execute this with the Debug button I get:

/Applications/XAMPP/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req   -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php --no-configuration /path/to/root/tests/
    Testing started at 19:41 ...

    Fatal error: Class 'tests\codeception\common\algorithm\DbTestCase' not found in /path/to/root/tests/codeception/common/algorithm/ObjectTest.php on line 23

    Call Stack:
        0.1083     357832   1. {main}() /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:0
        0.1313     983624   2. IDE_Base_PHPUnit_TextUI_Command::main(???) /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:552
        0.1313     989640   3. PHPUnit_TextUI_Command->run(???, ???) /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:294
        0.1372    1233680   4. PHPUnit_Runner_BaseTestRunner->getTest(???, ???) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/TextUI/Command.php:146
        0.1827    1430624   5. PHPUnit_Framework_TestSuite->addTestFiles(???) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Runner/BaseTestRunner.php:96
        0.1827    1431896   6. PHPUnit_Framework_TestSuite->addTestFile(???, ???) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Framework/TestSuite.php:419
        0.1844    1527936   7. PHPUnit_Util_Fileloader::checkAndLoad(???) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Framework/TestSuite.php:358
        0.1845    1528152   8. PHPUnit_Util_Fileloader::load(???) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Util/Fileloader.php:79
        0.1861    1710880   9. include_once('/Users/jareiter/Tabbie2/tabbie2.git/tests/codeception/common/algorithm/StrictWUDCRulesTest.php') /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Util/Fileloader.php:95

    PHP Fatal error:  Class 'tests\codeception\common\algorithm\DbTestCase' not found in /Users/jareiter/Tabbie2/tabbie2.git/tests/codeception/common/algorithm/StrictWUDCRulesTest.php on line 23
    PHP Stack trace:
    PHP   1. {main}() /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:0
    PHP   2. IDE_Base_PHPUnit_TextUI_Command::main($exit = *uninitialized*) /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:552
    PHP   3. PHPUnit_TextUI_Command->run($argv = *uninitialized*, $exit = *uninitialized*) /private/var/folders/lz/s7xjwdbx6bxdxhmzr31c26580000gn/T/ide-phpunit.php:294
    PHP   4. PHPUnit_Runner_BaseTestRunner->getTest($suiteClassName = *uninitialized*, $suiteClassFile = *uninitialized*) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/TextUI/Command.php:146
    PHP   5. PHPUnit_Framework_TestSuite->addTestFiles($filenames = *uninitialized*) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Runner/BaseTestRunner.php:96
    PHP   6. PHPUnit_Framework_TestSuite->addTestFile($filename = *uninitialized*, $phptOptions = *uninitialized*) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Framework/TestSuite.php:419
    PHP   7. PHPUnit_Util_Fileloader::checkAndLoad($filename = *uninitialized*) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Framework/TestSuite.php:358
    PHP   8. PHPUnit_Util_Fileloader::load($filename = *uninitialized*) /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Util/Fileloader.php:79
    PHP   9. include_once() /Applications/XAMPP/xamppfiles/lib/php/PHPUnit/Util/Fileloader.php:95

    Process finished with exit code 255

All files in the log exist!

1

1 Answers

0
votes

Codeception framework is not currently supported by Testing subsystem of PhpStorm.

https://youtrack.jetbrains.com/issue/WI-16350 -- watch this ticket (star/vote/comment) to get notified on progress.


You are trying to use PHPUnit integration to run your Codeception tests ... but that will not work like that because IDE uses intermediate helper script that works with PHPUnit directly. As you can see autoloader does not seem to help here...