1313
1414use PHPUnit \Framework \TestCase ;
1515use Symfony \Component \Messenger \Bridge \Beanstalkd \Tests \Fixtures \DummyMessage ;
16+ use Symfony \Component \Messenger \Bridge \Beanstalkd \Transport \BeanstalkdPriorityStamp ;
1617use Symfony \Component \Messenger \Bridge \Beanstalkd \Transport \BeanstalkdSender ;
1718use Symfony \Component \Messenger \Bridge \Beanstalkd \Transport \Connection ;
1819use Symfony \Component \Messenger \Envelope ;
@@ -27,7 +28,7 @@ public function testSend()
2728 $ encoded = ['body ' => '... ' , 'headers ' => ['type ' => DummyMessage::class]];
2829
2930 $ connection = $ this ->createMock (Connection::class);
30- $ connection ->expects ($ this ->once ())->method ('send ' )->with ($ encoded ['body ' ], $ encoded ['headers ' ], 0 );
31+ $ connection ->expects ($ this ->once ())->method ('send ' )->with ($ encoded ['body ' ], $ encoded ['headers ' ], 0 , null );
3132
3233 $ serializer = $ this ->createMock (SerializerInterface::class);
3334 $ serializer ->method ('encode ' )->with ($ envelope )->willReturn ($ encoded );
@@ -42,7 +43,22 @@ public function testSendWithDelay()
4243 $ encoded = ['body ' => '... ' , 'headers ' => ['type ' => DummyMessage::class]];
4344
4445 $ connection = $ this ->createMock (Connection::class);
45- $ connection ->expects ($ this ->once ())->method ('send ' )->with ($ encoded ['body ' ], $ encoded ['headers ' ], 500 );
46+ $ connection ->expects ($ this ->once ())->method ('send ' )->with ($ encoded ['body ' ], $ encoded ['headers ' ], 500 , null );
47+
48+ $ serializer = $ this ->createMock (SerializerInterface::class);
49+ $ serializer ->method ('encode ' )->with ($ envelope )->willReturn ($ encoded );
50+
51+ $ sender = new BeanstalkdSender ($ connection , $ serializer );
52+ $ sender ->send ($ envelope );
53+ }
54+
55+ public function testSendWithPriority ()
56+ {
57+ $ envelope = (new Envelope (new DummyMessage ('Oy ' )))->with (new BeanstalkdPriorityStamp (2 ));
58+ $ encoded = ['body ' => '... ' , 'headers ' => ['type ' => DummyMessage::class]];
59+
60+ $ connection = $ this ->createMock (Connection::class);
61+ $ connection ->expects ($ this ->once ())->method ('send ' )->with ($ encoded ['body ' ], $ encoded ['headers ' ], 0 , 2 );
4662
4763 $ serializer = $ this ->createMock (SerializerInterface::class);
4864 $ serializer ->method ('encode ' )->with ($ envelope )->willReturn ($ encoded );
0 commit comments