diff --git a/src/Extensions/RepeatedTest.php b/src/Extensions/RepeatedTest.php index c767f66bb2c..6d90c00cef4 100644 --- a/src/Extensions/RepeatedTest.php +++ b/src/Extensions/RepeatedTest.php @@ -93,6 +93,9 @@ public function run(PHPUnit_Framework_TestResult $result = null) //@codingStandardsIgnoreStart for ($i = 1; $i <= $this->timesRepeat && !$result->shouldStop(); $i++) { + // Make the repeat count widely available. + $_ENV['PHPUnit_RepeatedTest_RepeatCount'] = $i; + if ($this->onlyRepeatFailed && $i > 1 && $this->test instanceof PHPUnit_Framework_TestCase && diff --git a/tests/TextUI/repeat-onlyfailed-dataprovider.phpt b/tests/TextUI/repeat-onlyfailed-dataprovider.phpt new file mode 100644 index 00000000000..f99bd57f798 --- /dev/null +++ b/tests/TextUI/repeat-onlyfailed-dataprovider.phpt @@ -0,0 +1,29 @@ +--TEST-- +phpunit --repeat 3 --only-repeat-failed ../_files/DataProviderAlternateSuccessTest.php +--FILE-- + +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +F.S.SS + +Time: %s, Memory: %sMb + +There was 1 failure: + +1) DataProviderAlternateSuccessTest::testAlternateSuccess with data set #0 ('even') +Failed at run 1. + +/Users/pieterdc/Sites/phpunit-kanooh/tests/_files/DataProviderAlternateSuccessTest.php:17 + +FAILURES! +Tests: 3, Assertions: 0, Failures: 1, Skipped: 3. diff --git a/tests/_files/DataProviderAlternateSuccessTest.php b/tests/_files/DataProviderAlternateSuccessTest.php new file mode 100644 index 00000000000..8049374d0dc --- /dev/null +++ b/tests/_files/DataProviderAlternateSuccessTest.php @@ -0,0 +1,28 @@ +fail('Failed at run ' . $repeatCount . '.'); + } + } + + public static function providerMethod() + { + return array( + array('even'), + array('odd') + ); + } +}