@@ -109,7 +109,8 @@ public function assertResponseCookieValueSame(string $name, string $expectedValu
109109 */
110110 public function assertResponseFormatSame (?string $ expectedFormat , string $ message = '' ): void
111111 {
112- $ this ->assertThatForResponse (new ResponseFormatSame ($ this ->getClient ()->getRequest (), $ expectedFormat ), $ message );
112+ $ client = $ this ->getClient ();
113+ $ this ->assertThatForResponse (new ResponseFormatSame ($ client ->getRequest (), $ expectedFormat ), $ message );
113114 }
114115
115116 /**
@@ -233,14 +234,14 @@ public function assertResponseRedirects(?string $expectedLocation = null, ?int $
233234 {
234235 $ this ->assertThatForResponse (new ResponseIsRedirected ($ verbose ), $ message );
235236
236- if ($ expectedLocation ) {
237+ if ($ expectedLocation !== null ) {
237238 $ constraint = class_exists (ResponseHeaderLocationSame::class)
238239 ? new ResponseHeaderLocationSame ($ this ->getClient ()->getRequest (), $ expectedLocation )
239240 : new ResponseHeaderSame ('Location ' , $ expectedLocation );
240241 $ this ->assertThatForResponse ($ constraint , $ message );
241242 }
242243
243- if ($ expectedCode ) {
244+ if ($ expectedCode !== null ) {
244245 $ this ->assertThatForResponse (new ResponseStatusCodeSame ($ expectedCode ), $ message );
245246 }
246247 }
@@ -317,8 +318,9 @@ protected function doRebootClientKernel(): void {}
317318 public function seePageIsAvailable (?string $ url = null ): void
318319 {
319320 if ($ url !== null ) {
320- $ this ->getClient ()->request ('GET ' , $ url );
321- $ this ->assertStringContainsString ($ url , $ this ->getClient ()->getRequest ()->getRequestUri ());
321+ $ client = $ this ->getClient ();
322+ $ client ->request ('GET ' , $ url );
323+ $ this ->assertStringContainsString ($ url , $ client ->getRequest ()->getRequestUri ());
322324 }
323325
324326 $ this ->assertResponseIsSuccessful ();
@@ -370,10 +372,11 @@ public function submitSymfonyForm(string $name, array $fields): void
370372 $ params [$ name . $ key ] = $ value ;
371373 }
372374
373- $ node = $ this ->getClient ()->getCrawler ()->filter ($ selector );
375+ $ client = $ this ->getClient ();
376+ $ node = $ client ->getCrawler ()->filter ($ selector );
374377 $ this ->assertGreaterThan (0 , $ node ->count (), sprintf ('Form "%s" not found. ' , $ selector ));
375378 $ form = $ node ->form ();
376- $ this -> getClient () ->submit ($ form , $ params );
379+ $ client ->submit ($ form , $ params );
377380 }
378381
379382 protected function assertThatForClient (Constraint $ constraint , string $ message = '' ): void
0 commit comments