22
33namespace Enqueue \Tests \Symfony \Client ;
44
5+ use Enqueue \Client \Message ;
56use Enqueue \Client \ProducerInterface ;
67use Enqueue \Container \Container ;
78use Enqueue \Symfony \Client \ProduceCommand ;
@@ -112,11 +113,14 @@ public function testThrowIfBothTopicAndCommandOptionsAreSet()
112113
113114 public function testShouldSendEventToDefaultTransport ()
114115 {
116+ $ header = 'Content-Type: text/plain ' ;
117+ $ payload = 'theMessage ' ;
118+
115119 $ producerMock = $ this ->createProducerMock ();
116120 $ producerMock
117121 ->expects ($ this ->once ())
118122 ->method ('sendEvent ' )
119- ->with ('theTopic ' , ' theMessage ' )
123+ ->with ('theTopic ' , new Message ( $ payload , [], [ $ header ]) )
120124 ;
121125 $ producerMock
122126 ->expects ($ this ->never ())
@@ -129,18 +133,22 @@ public function testShouldSendEventToDefaultTransport()
129133
130134 $ tester = new CommandTester ($ command );
131135 $ tester ->execute ([
132- 'message ' => 'theMessage ' ,
136+ 'message ' => $ payload ,
137+ '--header ' => $ header ,
133138 '--topic ' => 'theTopic ' ,
134139 ]);
135140 }
136141
137142 public function testShouldSendCommandToDefaultTransport ()
138143 {
144+ $ header = 'Content-Type: text/plain ' ;
145+ $ payload = 'theMessage ' ;
146+
139147 $ producerMock = $ this ->createProducerMock ();
140148 $ producerMock
141149 ->expects ($ this ->once ())
142150 ->method ('sendCommand ' )
143- ->with ('theCommand ' , ' theMessage ' )
151+ ->with ('theCommand ' , new Message ( $ payload , [], [ $ header ]) )
144152 ;
145153 $ producerMock
146154 ->expects ($ this ->never ())
@@ -153,13 +161,17 @@ public function testShouldSendCommandToDefaultTransport()
153161
154162 $ tester = new CommandTester ($ command );
155163 $ tester ->execute ([
156- 'message ' => 'theMessage ' ,
164+ 'message ' => $ payload ,
165+ '--header ' => $ header ,
157166 '--command ' => 'theCommand ' ,
158167 ]);
159168 }
160169
161170 public function testShouldSendEventToFooTransport ()
162171 {
172+ $ header = 'Content-Type: text/plain ' ;
173+ $ payload = 'theMessage ' ;
174+
163175 $ defaultProducerMock = $ this ->createProducerMock ();
164176 $ defaultProducerMock
165177 ->expects ($ this ->never ())
@@ -174,7 +186,7 @@ public function testShouldSendEventToFooTransport()
174186 $ fooProducerMock
175187 ->expects ($ this ->once ())
176188 ->method ('sendEvent ' )
177- ->with ('theTopic ' , ' theMessage ' )
189+ ->with ('theTopic ' , new Message ( $ payload , [], [ $ header ]) )
178190 ;
179191 $ fooProducerMock
180192 ->expects ($ this ->never ())
@@ -188,7 +200,8 @@ public function testShouldSendEventToFooTransport()
188200
189201 $ tester = new CommandTester ($ command );
190202 $ tester ->execute ([
191- 'message ' => 'theMessage ' ,
203+ 'message ' => $ payload ,
204+ '--header ' => $ header ,
192205 '--topic ' => 'theTopic ' ,
193206 '--client ' => 'foo ' ,
194207 ]);
0 commit comments