Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9850f7d

Browse filesBrowse files
Fix PhpUnit 8 compatibility
1 parent e80e193 commit 9850f7d
Copy full SHA for 9850f7d

File tree

4 files changed

+83
-9
lines changed
Filter options

4 files changed

+83
-9
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Test/BaseKernelTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/BaseKernelTestCase.php
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
* KernelTestCase is the base class for tests needing a Kernel.
2121
*
2222
* @author Fabien Potencier <fabien@symfony.com>
23+
*
24+
* @internal
2325
*/
24-
abstract class KernelTestCase extends TestCase
26+
abstract class BaseKernelTestCase extends TestCase
2527
{
2628
protected static $class;
2729

@@ -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
}
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Test;
13+
14+
use PHPUnit\Runner\Version;
15+
16+
if (class_exists(Version::class) && version_compare(Version::id(), '8.0.0') >= 0) {
17+
class_alias(KernelTestCaseNew::class, KernelTestCase::class, true);
18+
} else {
19+
class_alias(KernelTestCaseOld::class, KernelTestCase::class, true);
20+
}
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Test;
13+
14+
/**
15+
* KernelTestCaseNew is the base class for tests needing a Kernel >= PHPUNIT 8.
16+
*
17+
* @author Fabien Potencier <fabien@symfony.com>
18+
*
19+
* @internal
20+
*/
21+
abstract class KernelTestCaseNew extends BaseKernelTestCase
22+
{
23+
/**
24+
* Clean up Kernel usage in this test.
25+
*/
26+
protected function tearDown(): void
27+
{
28+
static::ensureKernelShutdown();
29+
}
30+
}
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Test;
13+
14+
/**
15+
* KernelTestCaseOld is the base class for tests needing a Kernel <= PHPUNIT 7.
16+
*
17+
* @author Fabien Potencier <fabien@symfony.com>
18+
*
19+
* @internal
20+
*/
21+
abstract class KernelTestCaseOld extends BaseKernelTestCase
22+
{
23+
/**
24+
* Clean up Kernel usage in this test.
25+
*/
26+
protected function tearDown()
27+
{
28+
static::ensureKernelShutdown();
29+
}
30+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.