function WebAssert::addressEquals
Same name in other branches
- 9 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::addressEquals()
- 10 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::addressEquals()
Checks that current session address is equals to provided one.
Parameters
string|\Drupal\Core\Url $page: A url string, or object.
Return value
void
Throws
\Behat\Mink\Exception\ExpectationException
File
-
core/
tests/ Drupal/ Tests/ WebAssert.php, line 775
Class
- WebAssert
- Defines a class with methods for asserting presence of elements during tests.
Namespace
Drupal\TestsCode
public function addressEquals(string|Url $page) {
$expected = $this->cleanUrl($page, TRUE);
$actual = $this->cleanUrl($this->session
->getCurrentUrl(), str_contains($expected, '?'));
$this->assert($actual === $expected, sprintf('Current page is "%s", but "%s" expected.', $actual, $expected));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.