|
4 | 4 |
|
5 | 5 | require_once __DIR__.'/TestKernel.php'; |
6 | 6 |
|
| 7 | +use Bdf\Queue\Connection\ConnectionDriverInterface; |
7 | 8 | use Bdf\Queue\Connection\Prime\PrimeConnection; |
8 | 9 | use Bdf\Queue\Console\Command\BindCommand; |
9 | 10 | use Bdf\Queue\Console\Command\ConsumeCommand; |
|
25 | 26 | use Bdf\Queue\Failer\MemoryFailedJobRepository; |
26 | 27 | use Bdf\Queue\Message\Message; |
27 | 28 | use Bdf\Queue\Message\QueuedMessage; |
| 29 | +use Bdf\Queue\Serializer\JsonSerializer; |
| 30 | +use Bdf\Queue\Serializer\Serializer; |
28 | 31 | use Bdf\Queue\Testing\QueueHelper; |
29 | 32 | use Bdf\QueueBundle\BdfQueueBundle; |
30 | 33 | use Bdf\QueueBundle\Consumption\ReceiverLoader; |
31 | 34 | use Bdf\QueueBundle\Tests\Fixtures\Bar; |
32 | 35 | use Bdf\QueueBundle\Tests\Fixtures\Foo; |
| 36 | +use Bdf\QueueBundle\Tests\Fixtures\GetConnection; |
33 | 37 | use Bdf\QueueBundle\Tests\Fixtures\GetDestinationFactory; |
34 | 38 | use Bdf\QueueBundle\Tests\Fixtures\TestHandler; |
35 | 39 | use PHPUnit\Framework\TestCase; |
@@ -154,7 +158,7 @@ public function testConnectionOptions() |
154 | 158 | 'gearman' => [ |
155 | 159 | 'driver' => null, |
156 | 160 | 'host' => null, |
157 | | - 'serializer' => ['id' => 'native'], |
| 161 | + 'serializer' => ['id' => 'native', 'from_url' => false], |
158 | 162 | 'queue' => null, |
159 | 163 | 'url' => 'gearman://127.0.0.1', |
160 | 164 | 'options' => ['client_timeout' => 1], |
@@ -254,6 +258,20 @@ public function testPrimeConnection() |
254 | 258 | $destinations->queue('prime', 'queue_name'); |
255 | 259 | } |
256 | 260 |
|
| 261 | + public function testWithSerializerFromUrl() |
| 262 | + { |
| 263 | + $kernel = new \TestKernel(__DIR__.'/Fixtures/conf_with_serializer_from_dsn.yaml'); |
| 264 | + $kernel->boot(); |
| 265 | + |
| 266 | + /** @var ConnectionDriverInterface $connection */ |
| 267 | + $connection = $kernel->getContainer()->get(GetConnection::class)->get('queue'); |
| 268 | + $this->assertInstanceOf(JsonSerializer::class, $connection->serializer()); |
| 269 | + |
| 270 | + /** @var ConnectionDriverInterface $connection */ |
| 271 | + $connection = $kernel->getContainer()->get(GetConnection::class)->get('no_defined'); |
| 272 | + $this->assertInstanceOf(Serializer::class, $connection->serializer()); |
| 273 | + } |
| 274 | + |
257 | 275 | public function testDestinationFactoryInstance() |
258 | 276 | { |
259 | 277 | $kernel = new \TestKernel(); |
|
0 commit comments