File tree Expand file tree Collapse file tree 4 files changed +434
-7
lines changed Expand file tree Collapse file tree 4 files changed +434
-7
lines changed Original file line number Diff line number Diff line change 23
23
*/
24
24
abstract class KernelTestCase extends TestCase
25
25
{
26
- use KernelShutdownOnTearDownTrait ;
26
+ use TestCaseSetUpTearDownTrait ;
27
27
28
28
protected static $ class ;
29
29
@@ -37,6 +37,11 @@ abstract class KernelTestCase extends TestCase
37
37
*/
38
38
protected static $ container ;
39
39
40
+ protected function doTearDown (): void
41
+ {
42
+ static ::ensureKernelShutdown ();
43
+ }
44
+
40
45
/**
41
46
* @return string The Kernel class name
42
47
*
Original file line number Diff line number Diff line change 13
13
14
14
use PHPUnit \Framework \TestCase ;
15
15
16
- // Auto-adapt to PHPUnit 8 that added a `void` return-type to the tearDown method
16
+ // Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/ tearDown methods
17
17
18
18
if ((new \ReflectionMethod (TestCase::class, 'tearDown ' ))->hasReturnType ()) {
19
19
/**
20
20
* @internal
21
21
*/
22
- trait KernelShutdownOnTearDownTrait
22
+ trait TestCaseSetUpTearDownTrait
23
23
{
24
+ private function doSetUp (): void
25
+ {
26
+ }
27
+
28
+ private function doTearDown (): void
29
+ {
30
+ }
31
+
32
+ protected function setUp (): void
33
+ {
34
+ $ this ->doSetUp ();
35
+ }
36
+
24
37
protected function tearDown (): void
25
38
{
26
- static :: ensureKernelShutdown ();
39
+ $ this -> doTearDown ();
27
40
}
28
41
}
29
42
} else {
30
43
/**
31
44
* @internal
32
45
*/
33
- trait KernelShutdownOnTearDownTrait
46
+ trait TestCaseSetUpTearDownTrait
34
47
{
48
+ private function doSetUp (): void
49
+ {
50
+ }
51
+
52
+ private function doTearDown (): void
53
+ {
54
+ }
55
+
56
+ /**
57
+ * @return void
58
+ */
59
+ protected function setUp ()
60
+ {
61
+ $ this ->doSetUp ();
62
+ }
63
+
35
64
/**
36
65
* @return void
37
66
*/
38
67
protected function tearDown ()
39
68
{
40
- static :: ensureKernelShutdown ();
69
+ $ this -> doTearDown ();
41
70
}
42
71
}
43
72
}
You can’t perform that action at this time.
0 commit comments