You are here

public function WebAssert::assert in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::assert()
  2. 9 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.

File

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

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());
}