有没有一种方法可以直接在注释中指定测试参数?就像这样: /** * @dataProvider [[0, 0, 0], [0, 1, 1], [1, 0, 1]] */ public function testAdd($a, $b, $expected) { $this->assertEquals($expected, $a + $b); } 因为在只使用简单数据集时,DataProvider仅使用一次时可能很有用。
感谢Sebastian Bergmann,解决方案是使用@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); }