dongruoqiong9017 2016-07-11 02:41
浏览 258
已采纳

PHPUnit错误:使用dataProvider缺少参数1

I have the below test script:

class testTest extends PHPUnit_Framework_TestCase
{

    public function provider() {
        return [
            [1,false],
            [2,true]
        ];
    }

   /**
    * @test
    * @provider provider
    */
    public function test_test($num, $expected) {
        $actual = $num%2 ? false : true;
        $this->assertEquals($actual, $expected);
    }
}

Whenever I run this I get the error:

1)  testTest::test_test
Missing argument 1 for testTest::test_test()

I have other tests in my test suit that are not using dataProviders and they are working fine. How do I fix this ?

  • 写回答

1条回答 默认 最新

报告相同问题?