th3n3rd
th3n3rd

Reputation: 374

PHPStorm 8 and PHPUnit problems with @runInSeparateProcess

I am running phpunit (composer provisioned and version 4.8) from PHPStorm 8. Usually it works fine but whenever I need to use the @runInSeparateProcess annotation it starts screaming this error:

Fatal error: Class 'PHPUnit_Util_Configuration' not found in - on line 334

Call Stack:
0.0013     395808   1. {main}() -:0

The PHPUnit configuration on the IDE is the following:

This is the content of the configuration:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.2/phpunit.xsd"
         colors="true"
         bootstrap="./vendor/autoload.php"
         backupGlobals="false"
         backupStaticAttributes="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false">

    <testsuites>
        <testsuite name="My Project">
            <directory>./tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory suffix=".php">./src</directory>
        </whitelist>
    </filter>
</phpunit>

The tests run as expected from the command line with the same phpunit executable and the same configuration file.

Any suggestion?

Upvotes: 1

Views: 1333

Answers (2)

d.howser
d.howser

Reputation: 21

A modification of the fix the folks over at Drupal are using (https://www.drupal.org/node/2597814)

Add to the top of your boostrap file:

if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
    define('PHPUNIT_COMPOSER_INSTALL', __DIR__ . '/path/to/composer/vendors/dir/autoload.php');
}

I tried many other methods, including upgrading PHPStorm and up/down-grading PHPUnit. This works.

Upvotes: 1

th3n3rd
th3n3rd

Reputation: 374

Apparently removing all dependencies and re-installing phpunit from composer (phpunit 4.8.6) solved the problem.

Upvotes: 1

Related Questions