PHPUnit:使用@runTestsInSeparateProcesses 时找不到嘲弄

PHPUnit: Mockery not found when using @runTestsInSeparateProcesses

我将 PHPUnit 与 Mockery 一起使用,后者是我通过 composer 安装的:

"require-dev": {
    "mockery/mockery": "0.9.*"
},

现在,考虑以下测试用例

<?php

use Mockery as m;

class FooTest extends PHPUnit_Framework_TestCase {
    function testFoo() {
        m::mock('DateTime');
    }
}

phpunit 运行 很好。现在考虑以下内容:

use Mockery as m;

/**
 * @runTestsInSeparateProcesses
 * @preserveGlobalState disabled
 */
class FooTest extends PHPUnit_Framework_TestCase {
    function testFoo() {
        m::mock('DateTime');
    }
}

在这种情况下,我得到一个 Class 'Mockery' not found 异常。

Mockery 未找到 - 实际上,/vendor 目录中没有任何内容,就好像作曲家的自动加载完全搞砸了一样。我 运行 composer updatecomposer dump-autoload

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
>
    <testsuites>
        <testsuite name="Package Test Suite">
            <directory suffix=".php">./tests/</directory>
        </testsuite>

    </testsuites>
</phpunit>

我正在使用 PHPUnit 3.7.10,并且我 运行 使用没有任何参数的命令行 phpunit 进行测试。

我该如何解决这个问题?

升级到 PHPUnit 4.x 为我解决了这个问题。