protected function WebTestBase::assertPattern

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

Parameters

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

$message: (optional) A message to display with the assertion. Do not translate messages: use format_string() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.

Return value

TRUE on pass, FALSE on fail.

14 calls to WebTestBase::assertPattern()
AddFeedTest::testBasicFeedAddNoTitle in drupal/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
Tests drupal_add_feed() with paths, URLs, and titles.
BookTest::checkBookNode in drupal/core/modules/book/lib/Drupal/book/Tests/BookTest.php
Check the outline of sub-pages; previous, up, and next; and printer friendly version.
ColorTest::_testColor in drupal/core/modules/color/lib/Drupal/color/Tests/ColorTest.php
Tests the Color module functionality using the given theme.
CommentAnonymousTest::testAnonymous in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
Tests anonymous comment functionality.
FormTest::testFieldFormJSAddMore in drupal/core/modules/field/lib/Drupal/field/Tests/FormTest.php

... See full list

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 2344
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertPattern($pattern, $message = '', $group = 'Other') {
  if (!$message) {
    $message = t('Pattern "@pattern" found', array(
      '@pattern' => $pattern,
    ));
  }
  return $this
    ->assert((bool) preg_match($pattern, $this
    ->drupalGetContent()), $message, $group);
}