|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
15 | 15 | use Psr\Container\ContainerInterface;
|
| 16 | +use Symfony\Component\Messenger\Exception\InvalidArgumentException; |
16 | 17 | use Symfony\Component\Messenger\Transport\Schedule\ScheduleTransport;
|
17 | 18 | use Symfony\Component\Messenger\Transport\Schedule\ScheduleTransportFactory;
|
18 | 19 | use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
|
19 | 20 |
|
20 | 21 | class ScheduleTransportFactoryTest extends TestCase
|
21 | 22 | {
|
22 |
| - public function testOne() |
| 23 | + public function testCreateTransport() |
23 | 24 | {
|
24 | 25 | $serializer = $this->createMock(SerializerInterface::class);
|
25 | 26 | $container = new class() extends \ArrayObject implements ContainerInterface {
|
@@ -47,6 +48,24 @@ public function has(string $id): bool
|
47 | 48 | $this->assertEquals($custom, $factory->createTransport('schedule://custom', [], $serializer));
|
48 | 49 | }
|
49 | 50 |
|
| 51 | + public function testInvalidDsn() |
| 52 | + { |
| 53 | + $this->expectException(InvalidArgumentException::class); |
| 54 | + $this->expectExceptionMessage('The given Schedule DSN "schedule://#wrong" is invalid.'); |
| 55 | + |
| 56 | + $factory = new ScheduleTransportFactory($this->createMock(ContainerInterface::class)); |
| 57 | + $factory->createTransport('schedule://#wrong', [], $this->createMock(SerializerInterface::class)); |
| 58 | + } |
| 59 | + |
| 60 | + public function testNotFound() |
| 61 | + { |
| 62 | + $this->expectException(InvalidArgumentException::class); |
| 63 | + $this->expectExceptionMessage('The schedule "not-exists" is not found.'); |
| 64 | + |
| 65 | + $factory = new ScheduleTransportFactory($this->createMock(ContainerInterface::class)); |
| 66 | + $factory->createTransport('schedule://not-exists', [], $this->createMock(SerializerInterface::class)); |
| 67 | + } |
| 68 | + |
50 | 69 | public function testSupports()
|
51 | 70 | {
|
52 | 71 | $factory = new ScheduleTransportFactory($this->createMock(ContainerInterface::class));
|
|
0 commit comments