Skip to content

Commit f2fe471

Browse files
committed
Added availability check functions
1 parent 6c521ba commit f2fe471

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
@@ -475,6 +475,45 @@ public function seeInCurrentRoute($routeName)
475475
$this->assertEquals($matchedRouteName, $routeName);
476476
}
477477

478+
/**
479+
* Goes to a page and check that it can be accessed.
480+
*
481+
* ```php
482+
* <?php
483+
* $I->seePageIsAvailable('/dashboard');
484+
* ```
485+
*
486+
* @param string $url
487+
*/
488+
public function seePageIsAvailable($url)
489+
{
490+
$this->amOnPage($url);
491+
$this->seeResponseCodeIsSuccessful();
492+
$this->seeInCurrentUrl($url);
493+
}
494+
495+
/**
496+
* Goes to a page and check that it redirects to another.
497+
*
498+
* ```php
499+
* <?php
500+
* $I->seePageRedirectsTo('/admin', '/login');
501+
* ```
502+
*
503+
* @param string $page
504+
* @param string $redirectsTo
505+
*/
506+
public function seePageRedirectsTo($page, $redirectsTo)
507+
{
508+
$this->client->followRedirects(false);
509+
$this->amOnPage($page);
510+
$this->assertTrue(
511+
$this->client->getResponse()->isRedirection()
512+
);
513+
$this->client->followRedirect();
514+
$this->seeInCurrentUrl($redirectsTo);
515+
}
516+
478517
/**
479518
* Checks if the desired number of emails was sent.
480519
* If no argument is provided then at least one email must be sent to satisfy the check.

0 commit comments

Comments
 (0)