PHPUnit_Html icon indicating copy to clipboard operation
PHPUnit_Html copied to clipboard

second test with dataProvider fails

Open evpozdniakov opened this issue 14 years ago • 1 comments

Hello, nickturner!

I've just started using PHPUnit_Html and I like it! But recently I've discovered a problem. It is about using tests with data providers. I'm going to try describing the problem. Sorry for my english, which is not perfect.

So, when I create my first test with data provider, it seems to bee all fine — I see the test results on my web page. But if I add one more test with data provider, the result page doesn't change — I see results of the first test but can't see results of the second...

Below you are my code. The test example is taken from http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers

Hope you'll manage this problem, and thank you for your work!

class MyTest extends PHPUnit_Framework_TestCase { /** * @dataProvider provider */ public function testAdd($a, $b, $c) { $this->assertEquals($c, $a + $b); }

public function provider()
{
    return array(
        array(0, 0, 0),
        array(0, 1, 1),
        array(1, 0, 1),
        array(1, 1, 3)
    );
}

/**
 * @dataProvider provider2
 */
public function testAdd2($a, $b, $c)
{
    $this->assertEquals($c, $a + $b);
}

public function provider2()
{
    return array(
        array(0, 0, 0),
        array(0, 1, 1),
        array(1, 0, 1),
        array(1, 1, 2)
    );
}

}

evpozdniakov avatar Oct 26 '11 18:10 evpozdniakov

I have never used data providers in my unit tests so I will give your example script a go and try to see what is happening.

I know my PHPUnit_Html only caters for using PHPUnit in certain ways because it was developed my own use I never bothered about making it handle all the features of PHPUnit.

I will get back to you with updated code if I manage to get your example working.

Nick

----- Original Message ----- From: "Evgeniy Pozdnyakov" [email protected] To: "Nick Turner" [email protected] Sent: Wednesday, October 26, 2011 7:40 PM Subject: [PHPUnit_Html] second test with dataProvider fails (#1)

Hello, nickturner!

I've just started using PHPUnit_Html and I like it! But recently I've discovered a problem. It is about using tests with data providers. I'm going to try describing the problem. Sorry for my english, which is not perfect.

So, when I create my first test with data provider, it seems to bee all fine — I see the test results on my web page. But if I add one more test with data provider, the result page doesn't change — I see results of the first test but can't see results of the second...

Below you are my code. The test example is taken from http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers

Hope you'll manage this problem, and thank you for your work!

class MyTest extends PHPUnit_Framework_TestCase { /**

  • @dataProvider provider */ public function testAdd($a, $b, $c) { $this->assertEquals($c, $a + $b); }

public function provider() { return array( array(0, 0, 0), array(0, 1, 1), array(1, 0, 1), array(1, 1, 3) ); }

/**

  • @dataProvider provider2 */ public function testAdd2($a, $b, $c) { $this->assertEquals($c, $a + $b); }

public function provider2() { return array( array(0, 0, 0), array(0, 1, 1), array(1, 0, 1), array(1, 1, 2) ); } }

Reply to this email directly or view it on GitHub: https://github.com/nickturner/PHPUnit_Html/issues/1

nickturner avatar Oct 27 '11 09:10 nickturner