function 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.
14 calls to DrupalWebTestCase::assertPattern()
- BatchProcessingTestCase::assertBatchMessages in modules/
simpletest/ tests/ batch.test - Will trigger a pass if the texts were found in order in the raw content.
- BookTestCase::checkBookNode in modules/
book/ book.test - Checks the outline of sub-pages; previous, up, and next.
- ColorTestCase::_testColor in modules/
color/ color.test - Tests the Color module functionality using the given theme.
- CommentAnonymous::testAnonymous in modules/
comment/ comment.test - Test anonymous comment functionality.
- DrupalAddFeedTestCase::testBasicFeedAddNoTitle in modules/
simpletest/ tests/ common.test - Test drupal_add_feed() with paths, URLs, and titles.
File
-
modules/
simpletest/ drupal_web_test_case.php, line 3471
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.