protected function DrupalWebTestCase::assertPattern

7.x drupal_web_test_case.php protected DrupalWebTestCase::assertPattern($pattern, $message = '', $group = 'Other')

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


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

$message: Message to display.

$group: The group this message belongs to.

Return value

TRUE on pass, FALSE on fail.

12 calls to DrupalWebTestCase::assertPattern()
BatchProcessingTestCase::assertBatchMessages in drupal/modules/simpletest/tests/batch.test
Will trigger a pass if the texts were found in order in the raw content.
BookTestCase::checkBookNode in drupal/modules/book/book.test
Checks the outline of sub-pages; previous, up, and next.
ColorTestCase::_testColor in drupal/modules/color/color.test
Tests the Color module functionality using the given theme.
CommentAnonymous::testAnonymous in drupal/modules/comment/comment.test
Test anonymous comment functionality.
DrupalAddFeedTestCase::testBasicFeedAddNoTitle in drupal/modules/simpletest/tests/common.test
Test drupal_add_feed() with paths, URLs, and titles.

... See full list


drupal/modules/simpletest/drupal_web_test_case.php, line 3079


Test case for typical Drupal tests.


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