Permalink
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
-------

83a56a0 Fix phpunit 8 compatibility
  • Loading branch information...
nicolas-grekas committed Feb 8, 2019
2 parents db445c4 + 83a56a0 commit a36dc5127376b5c23bde0404f6d22dc80fefc242
Showing with 2 additions and 8 deletions.
  1. +2 −8 src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
@@ -208,6 +208,8 @@ protected static function createKernel(array $options = [])
}
/**
* @after
*
* Shuts the kernel down if it was used in the test.
*/
protected static function ensureKernelShutdown()
@@ -220,12 +222,4 @@ protected static function ensureKernelShutdown()
}
}
}
/**
* Clean up Kernel usage in this test.
*/
protected function tearDown()
{
static::ensureKernelShutdown();
}
}

0 comments on commit a36dc51

Please sign in to comment.