You are here

function ContemplateNodeTypeTemplating::testPageTemplate in Content Templates (Contemplate) 7

File

./contemplate.test, line 71
Tests for different parts of the contemplate system

Class

ContemplateNodeTypeTemplating
Test menu links depending on user permissions.

Code

function testPageTemplate() {

  // interface is alive and kicking
  $this
    ->drupalGet('admin/structure/types/manage/' . $this->type_name . '/template');
  $this
    ->assertText(t('Affect teaser output'));
  $this
    ->assertText(t('Leave this field blank to leave body unaffected'));
  $this
    ->drupalGet('admin/structure/types/manage/page/template');
  $this
    ->assertText(t('Affect teaser output'));
  $this
    ->assertText(t('Leave this field blank to leave body unaffected'));

  // check the node works before and after templating body (standard page type)
  $this
    ->drupalGet('node/' . $this->page_node->nid);
  $this
    ->assertText($this->test_body);

  // test different content types
  $edit = array();
  $edit['body-enable'] = true;
  $this
    ->drupalPost('admin/structure/types/manage/page/template', $edit, t('Save'));
  $testwrap = "xyz123xyz";
  $edit["bodyfield"] = $testwrap . '<?php print $node->body[$node->language][0][\'safe_value\'] ?>' . $testwrap;
  $this
    ->drupalPost('admin/structure/types/manage/page/template', $edit, t('Save'));
  $this
    ->assertText('template saved.');

  // submit a template for body and load the node to see if it stuck
  // load that node and see if it has that content
  $this
    ->drupalGet('node/' . $this->page_node->nid);
  $this
    ->assertText($testwrap);

  // see if extra stuff we add to the template appears
  $this
    ->assertText($this->test_body);
}