private function PageTitleTestCase::pageTitleCheck in Page Title 8.2
Same name and namespace in other branches
- 7.2 page_title.test \PageTitleTestCase::pageTitleCheck()
1 call to PageTitleTestCase::pageTitleCheck()
- PageTitleTestCase::testPageTitleTest in ./page_title.test
File
- ./page_title.test, line 35
- Test cases for the Page Title module.
Class
- PageTitleTestCase
- @file
Test cases for the Page Title module.
Code
private function pageTitleCheck($path, $pattern, $tokens = array(), $section = '') {
if (is_array($path)) {
$this
->drupalGet($path['path'], $path['options']);
}
else {
$this
->drupalGet($path);
}
$title = strtr($pattern, $tokens);
$this
->pass(t('Pattern: %pat', array(
'%pat' => '<title>' . $pattern . '</title>',
)));
$this
->pass(t('Looking for title: %title', array(
'%title' => '<title>' . $title . '</title>',
)));
$res = $this
->assertRaw($title, t('Correct page title found in the <head> for: %section', array(
'%section' => $section,
)), 'Page Title');
if (!$res) {
preg_match('/<title>.*<\\/title>/', $this
->drupalGetContent(), $found_title);
$this
->pass(t('Found instead: %found', array(
'%found' => $found_title[0],
)));
}
}