Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | final protected function messenger(?string $transport = null): TestTransport |
||
25 | { |
||
26 | if (!$this instanceof KernelTestCase) { |
||
27 | throw new \LogicException(\sprintf('The %s trait can only be used with %s.', __TRAIT__, KernelTestCase::class)); |
||
28 | } |
||
29 | |||
30 | if (!self::$container) { |
||
31 | self::bootKernel(); |
||
32 | } |
||
33 | |||
34 | if (!self::$container->has(TestTransportRegistry::class)) { |
||
35 | throw new \LogicException('Cannot access transport - is ZenstruckMessengerTestBundle enabled in your test environment?'); |
||
36 | } |
||
37 | |||
38 | return self::$container->get(TestTransportRegistry::class)->get($transport); |
||
39 | } |
||
41 |