bug #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 byc344203
but not in 2.8, 3.0 and 3.1. Commits -------f376cde
Fix time-sensitive tests that use data providers
This commit is contained in:
commit
6095835ea0
@ -134,7 +134,7 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener
|
||||
public function startTest(\PHPUnit_Framework_Test $test)
|
||||
{
|
||||
if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
|
||||
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName());
|
||||
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
|
||||
|
||||
if (in_array('time-sensitive', $groups, true)) {
|
||||
ClockMock::register(get_class($test));
|
||||
@ -146,7 +146,7 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener
|
||||
public function endTest(\PHPUnit_Framework_Test $test, $time)
|
||||
{
|
||||
if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
|
||||
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName());
|
||||
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
|
||||
|
||||
if (in_array('time-sensitive', $groups, true)) {
|
||||
ClockMock::withClockMock(false);
|
||||
|
Reference in New Issue
Block a user