Skip to content

Commit 26dea32

Browse files
bug #30084 Fix KernelTestCase compatibility for PhpUnit 8 (alexander-schranz)
This PR was merged into the 3.4 branch. Discussion ---------- Fix KernelTestCase compatibility for PhpUnit 8 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? |no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30071 | License | MIT | Doc PR | As the PhpUnit 8 Testcase has different return types as PhpUnit 7 there need to be 2 different classes to support both PhpUnit 8 and PhpUnit 7. With a class alias we can then change which version is used based on the PhpUnit Version constant. The fix is a little bit hacky but to support different major versions I see no other way. Not sure as we can't upgrade symfony/symfony to PhpUnit 8 how we can create a TestCase for this change. Commits ------- 83a56a0cbe Fix phpunit 8 compatibility
2 parents 5e634be + 023264d commit 26dea32

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Test/KernelTestCase.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ protected static function createKernel(array $options = [])
208208
}
209209

210210
/**
211+
* @after
212+
*
211213
* Shuts the kernel down if it was used in the test.
212214
*/
213215
protected static function ensureKernelShutdown()
@@ -220,12 +222,4 @@ protected static function ensureKernelShutdown()
220222
}
221223
}
222224
}
223-
224-
/**
225-
* Clean up Kernel usage in this test.
226-
*/
227-
protected function tearDown()
228-
{
229-
static::ensureKernelShutdown();
230-
}
231225
}

0 commit comments

Comments
 (0)