You are here

protected function DrupalWebTestCase::assertPattern in SimpleTest 7.2

Same name and namespace in other branches
  1. 6.2 drupal_web_test_case.php \DrupalWebTestCase::assertPattern()
  2. 7 drupal_web_test_case.php \DrupalWebTestCase::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: Message to display.

$group: The group this message belongs to.

Return value

TRUE on pass, FALSE on fail.

File

./drupal_web_test_case.php, line 2908
Provides DrupalTestCase, DrupalUnitTestCase, and DrupalWebTestCase classes.

Class

DrupalWebTestCase
Test case for typical Drupal tests.

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