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