Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 63.64% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | trait Factories |
||
16 | { |
||
17 | /** |
||
18 | * @internal |
||
19 | * @before |
||
20 | */ |
||
21 | 38 | public static function _setUpFactories(): void |
|
22 | { |
||
23 | 38 | if (!\is_subclass_of(static::class, KernelTestCase::class)) { |
|
24 | throw new \RuntimeException(\sprintf('The "%s" trait can only be used on TestCases that extend "%s".', __TRAIT__, KernelTestCase::class)); |
||
25 | } |
||
26 | |||
27 | PersistenceManager::register(new LazyManagerRegistry(static function() { |
||
28 | if (!static::$booted) { |
||
29 | static::bootKernel(); |
||
30 | } |
||
31 | |||
32 | return static::$kernel->getContainer()->get('doctrine'); |
||
33 | 38 | })); |
|
34 | 38 | } |
|
35 | |||
36 | /** |
||
37 | * @internal |
||
38 | * @after |
||
39 | */ |
||
40 | 38 | public static function _tearDownFactories(): void |
|
44 | 38 | } |
|
45 | } |
||
46 |