function WebAssert::addressNotEquals

Same name in other branches
  1. 9 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::addressNotEquals()
  2. 10 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::addressNotEquals()

Checks that current session address is not equals to provided one.

Parameters

string|\Drupal\Core\Url $page: A url string, or object.

Throws

\Behat\Mink\Exception\ExpectationException

File

core/tests/Drupal/Tests/WebAssert.php, line 790

Class

WebAssert
Defines a class with methods for asserting presence of elements during tests.

Namespace

Drupal\Tests

Code

public function addressNotEquals(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 should not be.', $actual));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.