function WebAssert::assert

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

Asserts a condition.

The parent method is overridden because it is a private method.

Parameters

bool $condition: The condition.

string $message: The success message.

Throws

\Behat\Mink\Exception\ExpectationException When the condition is not fulfilled.

12 calls to WebAssert::assert()
WebAssert::buttonNotExists in core/tests/Drupal/Tests/WebAssert.php
Checks that the specific button does NOT exist on the current page.
WebAssert::hiddenFieldNotExists in core/tests/Drupal/Tests/WebAssert.php
Checks that specific hidden field does not exist.
WebAssert::hiddenFieldValueEquals in core/tests/Drupal/Tests/WebAssert.php
Checks that specific hidden field have provided value.
WebAssert::hiddenFieldValueNotEquals in core/tests/Drupal/Tests/WebAssert.php
Checks that specific hidden field doesn't have the provided value.
WebAssert::linkByHrefExists in core/tests/Drupal/Tests/WebAssert.php
Passes if a link containing a given href (part) is found.

... See full list

File

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

Class

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

Namespace

Drupal\Tests

Code

public function assert($condition, $message) {
    if ($condition) {
        return;
    }
    throw new ExpectationException($message, $this->session
        ->getDriver());
}

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