publicfunctioncolourStatementsProvider() { returnarray( 'apple-is-green' => array('apple is green', 'apple', 'green'), 'apple-is-red' => array('apple is red', 'apple', 'red'), 'sky-is-blue' => array('sky is blue', 'sky', 'grey'), ); } }
Now run the test:
% phpunit DataProviderExampleTest.php PHPUnit 3.4.3 by Sebastian Bergmann.
..F
Time: 0 seconds
There was 1 failure:
1) DataProviderExampleTest::testItemIsCorrectColour with data set "sky-is-blue" ('sky is blue', 'sky', 'grey') Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -blue +grey
/Users/tim/Desktop/DataProviderExampleTest.php:12
FAILURES! Tests: 3, Assertions: 6, Failures: 1.
Here’s the testdox output:
% phpunit --testdox DataProviderExampleTest.php PHPUnit 3.4.3 by Sebastian Bergmann.
DataProviderExample [ ] Item is correct colour
In previous versions of PHPUnit there used to be more info…
in PHPUnit_Util_TestDox_ResultPrinter change the following line (246) from (part of the startTest function)
% phpunit --testdox DataProviderExampleTest.php PHPUnit 3.4.3 by Sebastian Bergmann.
DataProviderExample [x] Item is correct colour with data set "apple-is-green" [x] Item is correct colour with data set "apple-is-red" [ ] Item is correct colour with data set "sky-is-blue"