PhpUnit error in PhpStorm with exit code 255 in a Symfony 2 project

I'm having trouble phpunit working inside the Symfony project in PhpStorm - it phpunit -c appworks fine in the OSX terminal.

Here is the error:

Unable to attach test reporter to test framework of test framework quit unexpectedly
/Applications/MAMP/bin/php/php5.4.4/bin/php/private/var/folders/4l/hw8g4qlj6nnc37lfkc6hcj7w0000gn/T/ide-phpunit.php --bootstrap
/Users/greg/Repos/MyApp/app/bootstrap.php.cache --configuration    
/Users/greg/Repos/MyApp/app/phpunit.xml.dist
MyApp\MyBundle\Tests\Controller\MyControllerTest 
/Users/greg/Repos/MyApp/src/HvH/MyBundle/Tests/Controller/MyControllerTest.php

Testing started at 11:45 AM ...

Process finished with exit code 255

Edit: Here is the error from the PHP log:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The "app/" directory does not exist.' in /Users/greg/Repos/MyApp/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php:650
+5
source share
4 answers

I ran into the same problem and found the following solution in the documentation: http://symfony.com/doc/current/book/testing.html#your-first-functional-test

WebTestCase . . , ​​ , phpunit.xml.dist, KERNEL_DIR. :

<phpunit>
    <!-- ... -->
    <php>
        <server name="KERNEL_DIR" value="/path/to/your/app/" />
    </php>
    <!-- ... -->
</phpunit>

, phpunit.xml.dist .

, .

+5

PhpStorm , , " " run/debug. phpunit.xml.dist, (, JSON).

+2

, ( PHPStorm 8.0.1):

1) Preferences > PHP > PHPUnit , .

2) PHPUnit Run > Edit Configurations > Command Line , :

a) Custom working directory: /absolute/path/to/vendor.

b) check the "Use alternate configuration file" box and select it /absolute/path/to/vendor/your_app/(sub_app_if_applicable)/phpunit.xml.dist

Then you can run any test class in the package by specifying the class and file, or simply select the "Defined in configuration file" check box to run all of them according to the configuration.

+2
source

I ran into the same problem. If you are using yii2 / phpStorm, try selecting codeception.ymlinstead unit.ymlthe "alternative configuration file" section in the debug configuration section.

0
source

All Articles