Skip to content

Commit

Permalink
Fixed URL assertion logic (#339)
Browse files Browse the repository at this point in the history
* Fix URL page assertion bug (#325)

Any path that started with http:// or https:// (non-relative paths) was asserting true.

* Added behat test (#325)

* Dynamic images assertion support for 2.0 (#327)

* Don't use store when asserting amount of table rows (#335)

Co-authored-by: Andrew Servi <[email protected]>

* Fixed URL assertion logic (#325)

Co-authored-by: Rashid <[email protected]>
Co-authored-by: Andrew Servi <[email protected]>
Co-authored-by: Andrew Servi <[email protected]>
  • Loading branch information
4 people authored Apr 15, 2020
1 parent 4a8c9ad commit 31b0898
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Medology/Behat/Mink/FlexibleContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ public function assertPageAddressOnce($page)
parent::assertPageAddress($page);
} else {
// it's a full URL, compare manually
$actual = rtrim($this->getSession()->getCurrentUrl(), '/');
$page = rtrim($page, '/');
if ($actual !== $page) {
$actual = $this->getSession()->getCurrentUrl();
if (strpos($actual, $page) !== 0) {
throw new ExpectationException(
sprintf('Current page is "%s", but "%s" expected.', $actual, $page),
$this->getSession()
Expand Down

0 comments on commit 31b0898

Please sign in to comment.