Loading core/tests/Drupal/Tests/WebAssert.php +25 −6 Original line number Diff line number Diff line Loading @@ -45,9 +45,16 @@ public function __construct(Session $session, $base_url = '') { } /** * {@inheritdoc} * Trims the base URL from the URL. * * @param string|\Drupal\Core\Url $url * A url string, or object. * @param bool $include_query * Whether to include the query string in the return value. * * @return string */ protected function cleanUrl($url, $include_query = FALSE) { protected function cleanUrl(string|Url $url, bool $include_query = FALSE) { if ($url instanceof Url) { $url = $url->setAbsolute()->toString(); } Loading Loading @@ -752,9 +759,16 @@ public function pageContainsNoDuplicateId() { } /** * {@inheritdoc} * Checks that current session address is equals to provided one. * * @param string|\Drupal\Core\Url $page * A url string, or object. * * @return void * * @throws \Behat\Mink\Exception\ExpectationException */ public function addressEquals($page) { public function addressEquals(string|Url $page) { $expected = $this->cleanUrl($page, TRUE); $actual = $this->cleanUrl($this->session->getCurrentUrl(), str_contains($expected, '?')); Loading @@ -762,9 +776,14 @@ public function addressEquals($page) { } /** * {@inheritdoc} * Checks that current session address is not equals to provided one. * * @param string|\Drupal\Core\Url $page * A url string, or object. * * @throws \Behat\Mink\Exception\ExpectationException */ public function addressNotEquals($page) { public function addressNotEquals(string|Url $page) { $expected = $this->cleanUrl($page, TRUE); $actual = $this->cleanUrl($this->session->getCurrentUrl(), str_contains($expected, '?')); Loading Loading
core/tests/Drupal/Tests/WebAssert.php +25 −6 Original line number Diff line number Diff line Loading @@ -45,9 +45,16 @@ public function __construct(Session $session, $base_url = '') { } /** * {@inheritdoc} * Trims the base URL from the URL. * * @param string|\Drupal\Core\Url $url * A url string, or object. * @param bool $include_query * Whether to include the query string in the return value. * * @return string */ protected function cleanUrl($url, $include_query = FALSE) { protected function cleanUrl(string|Url $url, bool $include_query = FALSE) { if ($url instanceof Url) { $url = $url->setAbsolute()->toString(); } Loading Loading @@ -752,9 +759,16 @@ public function pageContainsNoDuplicateId() { } /** * {@inheritdoc} * Checks that current session address is equals to provided one. * * @param string|\Drupal\Core\Url $page * A url string, or object. * * @return void * * @throws \Behat\Mink\Exception\ExpectationException */ public function addressEquals($page) { public function addressEquals(string|Url $page) { $expected = $this->cleanUrl($page, TRUE); $actual = $this->cleanUrl($this->session->getCurrentUrl(), str_contains($expected, '?')); Loading @@ -762,9 +776,14 @@ public function addressEquals($page) { } /** * {@inheritdoc} * Checks that current session address is not equals to provided one. * * @param string|\Drupal\Core\Url $page * A url string, or object. * * @throws \Behat\Mink\Exception\ExpectationException */ public function addressNotEquals($page) { public function addressNotEquals(string|Url $page) { $expected = $this->cleanUrl($page, TRUE); $actual = $this->cleanUrl($this->session->getCurrentUrl(), str_contains($expected, '?')); Loading