Skip to content

Commit 18297e9

Browse files
authored
Make url parameter optional in seePageIsAvailable (Codeception#114)
1 parent a737d73 commit 18297e9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Codeception/Module/Symfony/BrowserAssertionsTrait.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,26 @@ public function rebootClientKernel(): void
3434
}
3535

3636
/**
37-
* Goes to a page and check that it can be accessed.
37+
* Verifies that a page is available.
38+
* By default it checks the current page, specify the `$url` parameter to change it.
3839
*
3940
* ```php
4041
* <?php
41-
* $I->seePageIsAvailable('/dashboard');
42+
* $I->amOnPage('/dashboard');
43+
* $I->seePageIsAvailable();
44+
*
45+
* $I->seePageIsAvailable('/dashboard'); // Same as above
4246
* ```
4347
*
44-
* @param string $url
48+
* @param string|null $url
4549
*/
46-
public function seePageIsAvailable(string $url): void
50+
public function seePageIsAvailable(string $url = null): void
4751
{
48-
$this->amOnPage($url);
52+
if ($url !== null) {
53+
$this->amOnPage($url);
54+
$this->seeInCurrentUrl($url);
55+
}
4956
$this->seeResponseCodeIsSuccessful();
50-
$this->seeInCurrentUrl($url);
5157
}
5258

5359
/**

0 commit comments

Comments
 (0)