function AssertContentTrait::assertTextPattern
Asserts that a Perl regex pattern is found in the plain-text content.
Parameters
string $pattern: Perl regex to look for including the regex delimiters.
string $message: (optional) A message to display with the assertion.
Return value
bool TRUE on pass.
Deprecated
in drupal:11.1.0 and is removed from drupal:12.0.0. There is no replacement.
See also
https://www.drupal.org/node/3476110
File
- 
              core/
tests/ Drupal/ KernelTests/ AssertContentTrait.php, line 718  
Class
- AssertContentTrait
 - Provides test methods to assert content.
 
Namespace
Drupal\KernelTestsCode
protected function assertTextPattern($pattern, $message = NULL) : bool {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3476110', E_USER_DEPRECATED);
  if (!isset($message)) {
    $message = new FormattableMarkup('Pattern "@pattern" found', [
      '@pattern' => $pattern,
    ]);
  }
  $this->assertMatchesRegularExpression($pattern, $this->getTextContent(), $message);
  return TRUE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.