function AssertLegacyTrait::assertPattern

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertPattern()

Triggers a pass if the Perl regex pattern is found in the raw content.

Parameters

string $pattern: Perl regex to look for including the regex delimiters.

Deprecated

in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseMatches() instead.

See also

https://www.drupal.org/node/3129738

1 call to AssertLegacyTrait::assertPattern()
BrowserTestBaseTest::testAssertPattern in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy assertPattern().

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 826

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertPattern($pattern) {
    @trigger_error('AssertLegacyTrait::assertPattern() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseMatches() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
    $this->assertSession()
        ->responseMatches($pattern);
}

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