function WebAssert::statusMessageContains

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

Asserts that a status message containing a given string exists.

Parameters

string $message: The partial message to assert.

string|null $type: The optional message type: status, error, or warning.

1 call to WebAssert::statusMessageContains()
JSWebAssert::statusMessageContains in core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php
1 method overrides WebAssert::statusMessageContains()
JSWebAssert::statusMessageContains in core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php

File

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

Class

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

Namespace

Drupal\Tests

Code

public function statusMessageContains(string $message, ?string $type = NULL) : void {
    $selector = $this->buildStatusMessageSelector($message, $type);
    try {
        $this->elementExists('xpath', $selector);
    } catch (ExpectationException $e) {
        Assert::fail($e->getMessage());
    }
}

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