You are here

public function PageTitleViewsTestCase::testPageTitleViewsTest in Page Title 6.2

File

tests/page_title_views_test.test, line 21
Test case to make sure Views & Page Title play nicely

Class

PageTitleViewsTestCase
@file Test case to make sure Views & Page Title play nicely

Code

public function testPageTitleViewsTest() {

  // In theory we dont need to do any setting up - the module should provide a default view...
  $view = views_get_view('test_view');

  /**
   * Lets check the frontpage page title is working
   */
  $this
    ->drupalGet('test');
  $title = '<title>' . $view->display['page_with_page_title_1']->display_options['page_title_pattern'] . '</title>';
  $this
    ->pass(check_plain($title));
  $title = str_replace('[site-name]', 'Drupal', $title);
  $this
    ->pass(check_plain($title));
  $this
    ->assertRaw($title, t('Correct frontpage Title in the head.'), 'Page Title');

  /**
   * Lets check the frontpage page title is working
   */
  $u = user_load(array(
    'uid' => 1,
  ));
  $this
    ->drupalGet('test/1');
  $title = '<title>' . $view->display['page_with_page_title_1']->display_options['arguments']['uid']['page_title_pattern'] . '</title>';
  $this
    ->pass(check_plain($title));
  $title = str_replace(array(
    '[site-name]',
    '%1',
  ), array(
    'Drupal',
    $u->name,
  ), $title);
  $this
    ->pass(check_plain($title));
  $this
    ->assertRaw($title, t('Correct frontpage Title in the head.'), 'Page Title');
}