Conditions | 5 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public static function _resetDatabase(): void |
||
20 | { |
||
21 | if (DatabaseResetter::hasBeenReset()) { |
||
22 | return; |
||
23 | } |
||
24 | |||
25 | if (!\is_subclass_of(static::class, KernelTestCase::class)) { |
||
26 | throw new \RuntimeException(\sprintf('The "%s" trait can only be used on TestCases that extend "%s".', __TRAIT__, KernelTestCase::class)); |
||
27 | } |
||
28 | |||
29 | static::ensureKernelShutdown(); |
||
30 | |||
31 | if ($isDAMADoctrineTestBundleEnabled = DatabaseResetter::isDAMADoctrineTestBundleEnabled()) { |
||
32 | // disable static connections for this operation |
||
33 | StaticDriver::setKeepStaticConnections(false); |
||
34 | } |
||
35 | |||
36 | DatabaseResetter::resetDatabase(static::bootKernel()); |
||
37 | |||
38 | if ($isDAMADoctrineTestBundleEnabled) { |
||
39 | // re-enable static connections |
||
40 | StaticDriver::setKeepStaticConnections(true); |
||
41 | } |
||
42 | |||
43 | static::ensureKernelShutdown(); |
||
44 | } |
||
68 |