story_preview.test in SimpleTest 6
File
tests/story_preview.test
View source
<?php
class StoryPreviewTest extends DrupalTestCase {
function get_info() {
return array(
'name' => 'Story preview test',
'desc' => t('We want a working preview for storys, uh?'),
'group' => 'Node Tests',
);
}
function testStoryPreview() {
$this
->drupalVariableSet('node_options_story', array(
'status',
'promote',
));
$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');
}
}