是否有一种方法可以在注释中直接指定测试参数?就像这样:
/**
* @dataProvider [[0, 0, 0], [0, 1, 1], [1, 0, 1]]
*/
public function testAdd($a, $b, $expected)
{
$this->assertEquals($expected, $a + $b);
}因为当DataProvider只与简单的数据集一起使用一次时,它会很有用。
发布于 2016-04-07 08:12:42
您描述的内容是在PHPUnit 4.8中添加的。
发布于 2016-04-07 08:23:21
多亏了Sebastian,解决方案是使用@testWith:
/**
* @testWith [0, 0, 0]
* [0, 1, 1]
* [1, 1, 2]
* [1, 0, 1]
*/
public function testAdd($a, $b, $c)
{
$this->assertEquals($c, $a + $b);
}https://stackoverflow.com/questions/36470000
复制相似问题