44
55namespace Codeception \Module \Symfony ;
66
7+ use Codeception \Lib \InnerBrowser ;
78use PHPUnit \Framework \Constraint \Constraint ;
89use PHPUnit \Framework \Constraint \LogicalAnd ;
910use PHPUnit \Framework \Constraint \LogicalNot ;
@@ -319,7 +320,13 @@ public function seePageIsAvailable(?string $url = null): void
319320 {
320321 if ($ url !== null ) {
321322 $ client = $ this ->getClient ();
322- $ client ->request ('GET ' , $ url );
323+
324+ if ($ this instanceof InnerBrowser) {
325+ $ this ->amOnPage ($ url );
326+ } else {
327+ $ client ->request ('GET ' , $ url );
328+ }
329+
323330 $ this ->assertStringContainsString ($ url , $ client ->getRequest ()->getRequestUri ());
324331 }
325332
@@ -338,7 +345,12 @@ public function seePageRedirectsTo(string $page, string $redirectsTo): void
338345 {
339346 $ client = $ this ->getClient ();
340347 $ client ->followRedirects (false );
341- $ client ->request ('GET ' , $ page );
348+
349+ if ($ this instanceof InnerBrowser) {
350+ $ this ->amOnPage ($ page );
351+ } else {
352+ $ client ->request ('GET ' , $ page );
353+ }
342354
343355 $ this ->assertThatForResponse (new ResponseIsRedirected (), 'The response is not a redirection. ' );
344356
@@ -365,14 +377,20 @@ public function seePageRedirectsTo(string $page, string $redirectsTo): void
365377 */
366378 public function submitSymfonyForm (string $ name , array $ fields ): void
367379 {
380+ $ client = $ this ->getClient ();
368381 $ selector = sprintf ('form[name=%s] ' , $ name );
369382
370383 $ params = [];
371384 foreach ($ fields as $ key => $ value ) {
372385 $ params [$ name . $ key ] = $ value ;
373386 }
374387
375- $ client = $ this ->getClient ();
388+ if ($ this instanceof InnerBrowser) {
389+ $ this ->submitForm ($ selector , $ params , sprintf ('%s_submit ' , $ name ));
390+
391+ return ;
392+ }
393+
376394 $ node = $ client ->getCrawler ()->filter ($ selector );
377395 $ this ->assertGreaterThan (0 , $ node ->count (), sprintf ('Form "%s" not found. ' , $ selector ));
378396 $ form = $ node ->form ();
0 commit comments