| Total Complexity | 4 |
| 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 | 964 | public static function _setUpFactories(): void |
|
| 20 | { |
||
| 21 | 964 | if (!\is_subclass_of(static::class, KernelTestCase::class)) { |
|
| 22 | 330 | TestState::bootFoundry(); |
|
| 23 | |||
| 24 | 330 | return; |
|
| 25 | } |
||
| 26 | |||
| 27 | 634 | $kernel = static::createKernel(); |
|
| 28 | 634 | $kernel->boot(); |
|
| 29 | |||
| 30 | 634 | TestState::bootFromContainer($kernel->getContainer()); |
|
| 31 | 634 | Factory::configuration()->setManagerRegistry( |
|
| 32 | new LazyManagerRegistry(static function() { |
||
| 33 | 588 | if (!static::$booted) { |
|
| 34 | 588 | static::bootKernel(); |
|
| 35 | } |
||
| 36 | |||
| 37 | 588 | return TestState::initializeChainManagerRegistry(static::$kernel->getContainer()); |
|
| 38 | 634 | } |
|
| 39 | ) |
||
| 40 | ); |
||
| 41 | 634 | ||
| 42 | 634 | $kernel->shutdown(); |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @internal |
||
| 47 | * @after |
||
| 48 | 964 | */ |
|
| 49 | public static function _tearDownFactories(): void |
||
| 52 | } |
||
| 53 | } |
||
| 54 |