PhpUnit内联数据提供程序

PhpUnit内联数据提供程序,php,phpunit,Php,Phpunit,有没有办法直接在注释中指定测试参数?大概是这样的: /** * @dataProvider [[0, 0, 0], [0, 1, 1], [1, 0, 1]] */ public function testAdd($a, $b, $expected) { $this->assertEquals($expected, $a + $b); } 因为当DataProvider仅用于简单数据集一次时,它会很有用。您所描述的内容已添加到中 多亏了塞巴斯蒂安·伯格曼,解决方案是使用:

有没有办法直接在注释中指定测试参数?大概是这样的:

 /**
 * @dataProvider [[0, 0, 0], [0, 1, 1], [1, 0, 1]]
 */
public function testAdd($a, $b, $expected)
{
    $this->assertEquals($expected, $a + $b);
}

因为当DataProvider仅用于简单数据集一次时,它会很有用。

您所描述的内容已添加到中

多亏了塞巴斯蒂安·伯格曼,解决方案是使用:

 /**
 * @testWith [0, 0, 0]
 *           [0, 1, 1]
 *           [1, 1, 2]
 *           [1, 0, 1]
 */
public function testAdd($a, $b, $c)
{
    $this->assertEquals($c, $a + $b);
}