@runInSeparateProcess 的 PHPStorm 8 和 PHPUnit 问题

PHPStorm 8 and PHPUnit problems with @runInSeparateProcess

我是 运行ning phpunit (composer provisioned and version 4.8) 来自 PHPStorm 8。通常它工作正常但每当我需要使用 @运行在SeparateProcess注释中它开始尖叫这个错误:

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

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

PHPIDE 上的单位配置如下:

这是配置的内容:

<?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>

使用相同的 php 单元可执行文件和相同的配置文件从命令行进行测试 运行。

有什么建议吗?

显然删除所有依赖项并从 composer (phpunit 4.8.6) 重新安装 phpunit 解决了问题。

对 Drupal 人员正在使用的修复程序的修改 (https://www.drupal.org/node/2597814)

添加到您的 boostrap 文件的顶部:

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

我尝试了很多其他方法,包括升级 PHPStorm 和 up/down-grading PHPUnit。这行得通。