@@ -116,8 +116,6 @@ public function testGetHasStamps(int $statusCode, string $receiveMode, bool $has
116116 self ::assertCount (1 , $ result );
117117
118118 $ envelope = $ result [0 ];
119- self ::assertInstanceOf (Envelope::class, $ envelope );
120-
121119 $ azureReceivedStamp = $ envelope ->last (AzureReceivedStamp::class);
122120 self ::assertInstanceOf (AzureReceivedStamp::class, $ azureReceivedStamp );
123121
@@ -133,7 +131,7 @@ public function testGetHasStamps(int $statusCode, string $receiveMode, bool $has
133131 }
134132
135133 /**
136- * @return array{int, string, bool}
134+ * @return array{int, string, bool}[]
137135 */
138136 public function provideValidGetCases (): array
139137 {
@@ -178,7 +176,10 @@ public function testAckRejectDoesNotDeleteOnReceiveAndDeleteMode(string $methodN
178176 );
179177
180178 $ envelope = new Envelope (new class {});
181- call_user_func ([$ transport , $ methodName ], $ envelope );
179+
180+ /** @var callable $method */
181+ $ method = [$ transport , $ methodName ];
182+ call_user_func ($ method , $ envelope );
182183 }
183184
184185 /**
@@ -209,7 +210,10 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface {
209210 $ envelope = new Envelope (new class {}, [
210211 new AzureReceivedStamp ('message ' , $ expectedUrl ),
211212 ]);
212- call_user_func ([$ transport , $ methodName ], $ envelope );
213+
214+ /** @var callable $method */
215+ $ method = [$ transport , $ methodName ];
216+ call_user_func ($ method , $ envelope );
213217 }
214218
215219 /**
@@ -232,7 +236,10 @@ public function testAckRejectWithoutDeleteLocationOrBrokerProperties(string $met
232236 $ envelope = new Envelope (new class {}, [
233237 new AzureReceivedStamp ('message ' , null ),
234238 ]);
235- call_user_func ([$ transport , $ methodName ], $ envelope );
239+
240+ /** @var callable $method */
241+ $ method = [$ transport , $ methodName ];
242+ call_user_func ($ method , $ envelope );
236243 }
237244
238245 /**
@@ -255,7 +262,10 @@ public function testAckRejectWithoutBrokerPropertiesMessageIdentifier(string $me
255262 $ envelope = new Envelope (new class {}, [
256263 new AzureBrokerPropertiesStamp (),
257264 ]);
258- call_user_func ([$ transport , $ methodName ], $ envelope );
265+
266+ /** @var callable $method */
267+ $ method = [$ transport , $ methodName ];
268+ call_user_func ($ method , $ envelope );
259269 }
260270
261271 /**
@@ -278,7 +288,10 @@ public function testAckRejectWithoutBrokerPropertiesLockToken(
278288
279289
280290 $ envelope = new Envelope (new class {}, [$ stamp ]);
281- call_user_func ([$ transport , $ methodName ], $ envelope );
291+
292+ /** @var callable $method */
293+ $ method = [$ transport , $ methodName ];
294+ call_user_func ($ method , $ envelope );
282295 }
283296
284297 /**
@@ -362,7 +375,10 @@ function (string $method, string $url) use ($expectedUrl): ResponseInterface {
362375 $ messageId
363376 ),
364377 ]);
365- call_user_func ([$ transport , $ methodName ], $ envelope );
378+
379+ /** @var callable $method */
380+ $ method = [$ transport , $ methodName ];
381+ call_user_func ($ method , $ envelope );
366382 }
367383
368384 /**
@@ -389,7 +405,10 @@ public function testAckRejectThrowsOnHttpError(string $methodName): void
389405 $ envelope = new Envelope (new class {}, [
390406 new AzureReceivedStamp ('message ' , 'https://delete-location ' ),
391407 ]);
392- call_user_func ([$ transport , $ methodName ], $ envelope );
408+
409+ /** @var callable $method */
410+ $ method = [$ transport , $ methodName ];
411+ call_user_func ($ method , $ envelope );
393412 }
394413
395414 /**
@@ -436,6 +455,29 @@ public function testSendWithBrokerPropertiesStampGetsConvertedToHttpHeader(): vo
436455 $ transport ->send ($ envelope );
437456 }
438457
458+ /**
459+ * JSON encoding exception of the BrokerProperties must throw a transport exception
460+ */
461+ public function testSendWithBrokerPropertiesJsonErrorThrowsTransportException (): void
462+ {
463+ self ::expectException (TransportException::class);
464+ self ::expectExceptionCode (1644511135 );
465+
466+ $ envelope = new Envelope (new class {}, [
467+ // Send "Malformed UTF-8 characters"
468+ new AzureBrokerPropertiesStamp ("\xB1\x31" ),
469+ ]);
470+
471+ $ transport = new AzureTransport (
472+ self ::createMock (SerializerInterface::class),
473+ new MockHttpClient (),
474+ new MockHttpClient (),
475+ AzureTransport::RECEIVE_MODE_RECEIVE_AND_DELETE
476+ );
477+
478+ $ transport ->send ($ envelope );
479+ }
480+
439481 /**
440482 * The encoded enveloppe must have a "body" key
441483 */
0 commit comments