PhpUnit - PHPUnit_Util_Configuration not found

This problem occurs in case I set for class PhpUnit anotations:

/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/

I'm getting the following error then:

 

PHP Fatal error:  Uncaught Error: Class 'PHPUnit_Util_Configuration' not found in -:76
Stack trace:
#0 {main}
  thrown in - on line 76

Fatal error: Uncaught Error: Class 'PHPUnit_Util_Configuration' not found in - on line 76

Error: Class 'PHPUnit_Util_Configuration' not found in - on line 76

Call Stack:
    0.0001     372440   1. {main}() -:0


In PhpUnit configuration I have set *Use custom autoloader* and *Default configuration file*. All other tests are working without a problem

I also want to add it's not PhpUnit issue, because when I run those tests in console, they are working without a problem.

Just for reference - I'm using Remote PHP intepreter with SSH settings filled in.

 

5 comments

Hello,

Does it work fine with the local interpreter?

Could you try to run this with phpunit.phar instead of an autoloader?

0

Hi

Thank you for reply

Sorry, but I cannot test it using local interpreter ( I don't have PHP installed locally).

And to be precise in vendor I have version 4.8.24 installed

However when I downloaded phpunit.phar (exactly 5.3.2 version) and run phpunit via PhpStorm using 5.3.2 phar it's working fine BUT when I used phpunit.phat in version 4.8.24 (exactly same as in vendor) I'm getting other errors:

 

PHPUnit 4.8.24 by Sebastian Bergmann and contributors.


Warning: require(/usr/share/nginx/html/.phpstorm_helpers/phpunit.php(196) : eval()'d code): failed to open stream: No such file or directory in - on line 22

Call Stack:
    0.0001     379864   1. {main}() -:0


Fatal error: require(): Failed opening required '/usr/share/nginx/html/.phpstorm_helpers/phpunit.php(196) : eval()'d code' (include_path='/usr/share/nginx/html/vendor/phpseclib/phpseclib/phpseclib:.:/usr/local/lib/php') in - on line 22

Call Stack:
    0.0001     379864   1. {main}() -:0

Warning: require(/usr/share/nginx/html/.phpstorm_helpers/phpunit.php(196) : eval()'d code): failed to open stream: No such file or directory in - on line 22

Call Stack:


Just in case - this phpunit.php file exists. I'm using latest PhpStorm build 145.969 build.

0

Hi Marcin,

There is an issue with PHPUnit 4.* (version 5 works fine): <https://youtrack.jetbrains.com/issue/WI-20946>.

Please vote for it in order to move it up in the queue and receive notifications regarding the progress of the feature. See more information on working with tracker at <https://intellij-support.jetbrains.com/entries/23368682>.

0

You can also run into this problem with PHPUnit 5 & 6. Note that Namespaces changed in PHPUnit 6.

Try copying the command from the first line in the test window to your command line. If you have something like

`/usr/local/bin/php /var/folders/cs/6xs685_dvx63w_lv3h00gn/T/ide-phpunit.php --bootstrap ...`

and it fails, try changing your preferences from Use Composer autoloader to Path to phpunit.phar. In particular, choose 

PhpStorm -> Preferences -> Languages & Frameworks ->PHP -> PHPUnit

You can likely choose ./vendor/bin/phpunit even though it is a link without the .phar extension.

 

0

Please sign in to leave a comment.