Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | trait Factories |
||
14 | { |
||
15 | /** |
||
16 | * @internal |
||
17 | * @before |
||
18 | */ |
||
19 | 731 | public static function _setUpFactories(): void |
|
20 | { |
||
21 | 731 | if (!\is_subclass_of(static::class, KernelTestCase::class)) { |
|
22 | 264 | TestState::bootFoundry(); |
|
23 | |||
24 | 264 | return; |
|
25 | } |
||
26 | |||
27 | 467 | if (!static::$booted) { |
|
28 | 467 | static::bootKernel(); |
|
29 | } |
||
30 | |||
31 | 467 | TestState::bootFromContainer(static::$kernel->getContainer()); |
|
32 | 467 | Factory::configuration()->setManagerRegistry( |
|
33 | new LazyManagerRegistry(static function() { |
||
34 | 214 | if (!static::$booted) { |
|
35 | 214 | static::bootKernel(); |
|
36 | } |
||
37 | |||
38 | 214 | return static::$kernel->getContainer()->get('doctrine'); |
|
39 | 467 | }) |
|
40 | ); |
||
41 | |||
42 | 467 | self::ensureKernelShutdown(); |
|
43 | 467 | } |
|
44 | |||
45 | /** |
||
46 | * @internal |
||
47 | * @after |
||
48 | */ |
||
49 | 731 | public static function _tearDownFactories(): void |
|
52 | 731 | } |
|
53 | } |
||
54 |