Skip to content

Commit a51056b

Browse files
authored
Added availability check functions
2 parents a921d1f + f2fe471 commit a51056b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,45 @@ public function seeInCurrentRoute($routeName)
455455
$this->assertEquals($matchedRouteName, $routeName);
456456
}
457457

458+
/**
459+
* Goes to a page and check that it can be accessed.
460+
*
461+
* ```php
462+
* <?php
463+
* $I->seePageIsAvailable('/dashboard');
464+
* ```
465+
*
466+
* @param string $url
467+
*/
468+
public function seePageIsAvailable($url)
469+
{
470+
$this->amOnPage($url);
471+
$this->seeResponseCodeIsSuccessful();
472+
$this->seeInCurrentUrl($url);
473+
}
474+
475+
/**
476+
* Goes to a page and check that it redirects to another.
477+
*
478+
* ```php
479+
* <?php
480+
* $I->seePageRedirectsTo('/admin', '/login');
481+
* ```
482+
*
483+
* @param string $page
484+
* @param string $redirectsTo
485+
*/
486+
public function seePageRedirectsTo($page, $redirectsTo)
487+
{
488+
$this->client->followRedirects(false);
489+
$this->amOnPage($page);
490+
$this->assertTrue(
491+
$this->client->getResponse()->isRedirection()
492+
);
493+
$this->client->followRedirect();
494+
$this->seeInCurrentUrl($redirectsTo);
495+
}
496+
458497
/**
459498
* Checks if the desired number of emails was sent.
460499
* If no argument is provided then at least one email must be sent to satisfy the check.

0 commit comments

Comments
 (0)