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