PagePreviewTestCase::testPagePreview

7 node.test PagePreviewTestCase::testPagePreview()
8 node.test PagePreviewTestCase::testPagePreview()

Check the node preview functionality.

File

modules/node/node.test, line 416
Tests for node.module.

Code

function testPagePreview() {
  $langcode = LANGUAGE_NONE;
  $title_key = "title";
  $body_key = "body[$langcode][0][value]";

  // Fill in node creation form and preview node.
  $edit = array();
  $edit[$title_key] = $this->randomName(8);
  $edit[$body_key] = $this->randomName(16);
  $this->drupalPost('node/add/page', $edit, t('Preview'));

  // Check that the preview is displaying the title and body.
  $this->assertTitle(t('Preview | Drupal'), t('Basic page title is preview.'));
  $this->assertText($edit[$title_key], t('Title displayed.'));
  $this->assertText($edit[$body_key], t('Body displayed.'));

  // Check that the title and body fields are displayed with the correct values.
  $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
  $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
}
Login or register to post comments