Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
15 | 3 | public function setUp(): void |
|
16 | { |
||
17 | 3 | if (!$this instanceof KernelTestCase) { |
|
18 | 1 | throw new LogicException('The "FixtureAttachedTrait" should only be used on objects extending the symfony/framework-bundle KernelTestCase.'); |
|
19 | } |
||
20 | |||
21 | 2 | self::bootKernel(); |
|
22 | |||
23 | 2 | if (!self::$container->has(ManagerRegistry::class)) { |
|
24 | 1 | throw new LogicException('No Doctrine ManagerRegistry service has been found in the service container. Please provide an implementation.'); |
|
25 | } |
||
26 | |||
27 | /** @var ManagerRegistry $registry */ |
||
28 | 1 | $registry = self::$container->get(ManagerRegistry::class); |
|
29 | 1 | $fixtureName = static::getFixtureNameForTestCase(get_class($this)); |
|
30 | 1 | $this->loadFixture( |
|
31 | 1 | $registry->getManager(), |
|
32 | 1 | new $fixtureName() |
|
33 | ); |
||
34 | 1 | } |
|
35 | |||
41 |