dimanche 10 juillet 2016

PHPUnit error: Missing argument 1 for with dataProvider

I have the below test script:

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

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

Whenever I run this I get the error:

1) adminQueryTest::test_test
Missing argument 1 for adminQueryTest::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 ?

Aucun commentaire:

Enregistrer un commentaire