@@ -179,6 +179,49 @@ public function testShouldReceiveMessage()
179179 $ this ->assertSame ('the body ' , $ message ->getBody ());
180180 }
181181
182+ public function testShouldReceiveMessageProtobufFormat ()
183+ {
184+ $ body = '2test+customer_6115118118117248@example.com"4test+customer_611511118118117248@example.com*&App\Tests\Entity\Entity497709 ' ;
185+ $ attributes = [
186+ 'ce-datacontenttype ' => 'application/protobuf ' ,
187+ ];
188+
189+ $ nativeMessage = new Message ([
190+ 'data ' => $ body ,
191+ 'attributes ' => $ attributes ,
192+ ], []);
193+
194+ $ subscription = $ this ->createSubscriptionMock ();
195+ $ subscription
196+ ->expects ($ this ->once ())
197+ ->method ('pull ' )
198+ ->with ($ this ->identicalTo ([
199+ 'maxMessages ' => 1 ,
200+ 'requestTimeout ' => 12.345 ,
201+ ]))
202+ ->willReturn ([$ nativeMessage ]);
203+
204+ $ client = $ this ->createPubSubClientMock ();
205+ $ client
206+ ->expects ($ this ->once ())
207+ ->method ('subscription ' )
208+ ->willReturn ($ subscription );
209+
210+ $ context = $ this ->createContextMock ();
211+ $ context
212+ ->expects ($ this ->once ())
213+ ->method ('getClient ' )
214+ ->willReturn ($ client );
215+
216+ $ consumer = new GpsConsumer ($ context , new GpsQueue ('queue-name ' ));
217+
218+ $ message = $ consumer ->receive (12345 );
219+
220+ $ this ->assertInstanceOf (GpsMessage::class, $ message );
221+ $ this ->assertSame ($ body , $ message ->getBody ());
222+ $ this ->assertSame ($ attributes , $ message ->getProperties ());
223+ }
224+
182225 /**
183226 * @return \PHPUnit\Framework\MockObject\MockObject|GpsContext
184227 */
0 commit comments