1515use Symfony \Component \Notifier \Exception \InvalidArgumentException ;
1616use Symfony \Component \Notifier \Exception \LogicException ;
1717use Symfony \Component \Notifier \Message \ChatMessage ;
18+ use Symfony \Component \Notifier \Message \SentMessage ;
1819use Symfony \Component \Notifier \Transport \TransportInterface ;
1920use Symfony \Component \Notifier \Transport \Transports ;
2021
@@ -30,9 +31,12 @@ public function testSendToTransportDefinedByMessage(): void
3031
3132 $ one ->method ('supports ' )->with ($ message )->willReturn (true );
3233
33- $ one ->expects ($ this ->once ())->method ('send ' );
34+ $ one ->expects ($ this ->once ())->method ('send ' )-> willReturn ( new SentMessage ( $ message , ' one ' )) ;
3435
35- $ transports ->send ($ message );
36+ $ sentMessage = $ transports ->send ($ message );
37+
38+ $ this ->assertSame ($ message , $ sentMessage ->getOriginalMessage ());
39+ $ this ->assertSame ('one ' , $ sentMessage ->getTransport ());
3640 }
3741
3842 public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATransport (): void
@@ -47,10 +51,16 @@ public function testSendToFirstSupportedTransportIfMessageDoesNotDefineATranspor
4751 $ one ->method ('supports ' )->with ($ message )->willReturn (false );
4852 $ two ->method ('supports ' )->with ($ message )->willReturn (true );
4953
54+ $ one ->method ('send ' )->with ($ message )->willReturn (new SentMessage ($ message , 'one ' ));
55+ $ two ->method ('send ' )->with ($ message )->willReturn (new SentMessage ($ message , 'two ' ));
56+
5057 $ one ->expects ($ this ->never ())->method ('send ' );
51- $ two ->expects ($ this ->once ())->method ('send ' );
58+ $ two ->expects ($ this ->once ())->method ('send ' )-> willReturn ( new SentMessage ( $ message , ' two ' )) ;
5259
53- $ transports ->send ($ message );
60+ $ sentMessage = $ transports ->send ($ message );
61+
62+ $ this ->assertSame ($ message , $ sentMessage ->getOriginalMessage ());
63+ $ this ->assertSame ('two ' , $ sentMessage ->getTransport ());
5464 }
5565
5666 public function testThrowExceptionIfNoSupportedTransportWasFound (): void
0 commit comments