You are here

function StoryPreviewTest::testStoryPreview in SimpleTest 6

File

tests/story_preview.test, line 17

Class

StoryPreviewTest
Test file for story_preview

Code

function testStoryPreview() {

  /* Prepare settings */
  $this
    ->drupalVariableSet('node_options_story', array(
    'status',
    'promote',
  ));

  /* Prepare a user to do the stuff */
  $web_user = $this
    ->drupalCreateUserRolePerm(array(
    'edit own story content',
    'create story content',
  ));
  $this
    ->drupalLoginUser($web_user);
  $edit = array(
    'title' => '!SimpleTest! title' . $this
      ->randomName(20),
    'body' => '!SimpleTest! body' . $this
      ->randomName(200),
  );
  $this
    ->drupalPost('node/add/story', $edit, 'Preview');
  $this
    ->assertWantedText(t('Preview'), 'Preview text is here');
  $this
    ->assertWantedText(t($edit['title']), 'Hello, the random title');
  $this
    ->assertWantedText(t($edit['body']), 'test is over, the body\'s still there');
  $this
    ->assertFieldByName('title', $edit['title'], 'The title is on it\'s place');
}