Skip to content

Commit 6095835

Browse files
bug symfony#20544 [PhpUnitBridge] Fix time-sensitive tests that use data providers (julienfalque)
This PR was merged into the 2.8 branch. Discussion ---------- [PhpUnitBridge] Fix time-sensitive tests that use data providers | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - When a test uses a data provider, the `@group time-sensitive` annotation does not work if it is set on the method because the test name includes the data provider name by default. This was fixed in master by c344203 but not in 2.8, 3.0 and 3.1. Commits ------- f376cde Fix time-sensitive tests that use data providers
2 parents 7487ccb + f376cde commit 6095835

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $ti
134134
public function startTest(\PHPUnit_Framework_Test $test)
135135
{
136136
if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
137-
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName());
137+
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
138138

139139
if (in_array('time-sensitive', $groups, true)) {
140140
ClockMock::register(get_class($test));
@@ -146,7 +146,7 @@ public function startTest(\PHPUnit_Framework_Test $test)
146146
public function endTest(\PHPUnit_Framework_Test $test, $time)
147147
{
148148
if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
149-
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName());
149+
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
150150

151151
if (in_array('time-sensitive', $groups, true)) {
152152
ClockMock::withClockMock(false);

0 commit comments

Comments
 (0)