【发布时间】:2012-06-15 12:52:46
【问题描述】:
我有一个看起来像这样的 PHPUnit 测试:
/**
* @dataProvider provideSomeStuff
*/
public function testSomething($a, $b, $c)
{
...
}
/**
* @dataProvider provideSomeStuff
* @depends testSomething
*/
public function testSomethingElse($a, $b, $c)
{
...
}
/**
* @depends testSomething
*/
public function testMoreStuff()
{
...
}
// Several more tests with the exact same setup as testMoreStuff
即使testSomething 成功,所有依赖它的测试都会被跳过。 PHPUnit manual 中的一些注释告知测试可以依赖于使用数据提供程序的其他测试:
注意
当一个测试从 @dataProvider 方法和它 @depends 的一个或多个测试接收输入时,来自数据提供者的参数将位于依赖测试的参数之前。注意
当测试依赖于使用数据提供者的测试时,依赖的测试将在其依赖的测试对至少一个数据集成功时执行。使用数据提供者的测试结果不能注入到依赖测试中。
所以我不知道为什么它会跳过我的所有测试。我已经为此苦苦挣扎了几个小时,有人帮助我。 Here's the complete test code 万一问题不能从上述伪代码导出
测试结果截图:
【问题讨论】:
-
我尝试提供测试结果,但无法从终端复制 (Just asked why on AskUbuntu)