function WorkbenchModerationPublishFromNodeFormTestCase::testPublishFromNodeForm in Workbench Moderation 7
Same name and namespace in other branches
- 7.3 tests/workbench_moderation.test \WorkbenchModerationPublishFromNodeFormTestCase::testPublishFromNodeForm()
File
- tests/workbench_moderation.test, line 222
- Tests for workbench_moderation.module.
Class
- WorkbenchModerationPublishFromNodeFormTestCase
Code
function testPublishFromNodeForm() {
$body_name = 'body[' . LANGUAGE_NONE . '][0]';
$edit = array(
'title' => $this
->randomName(),
"{$body_name}[value]" => $this
->randomString(128),
"{$body_name}[format]" => filter_default_format(),
'workbench_moderation_state_new' => workbench_moderation_state_published(),
);
$this
->drupalPost("node/add/{$this->content_type}", $edit, t('Save'));
$node = $this
->drupalGetNodeByTitle($edit['title']);
$this
->assertTrue(isset($node->workbench_moderation['published']), t('Workbench moderation has a published revision'));
$this
->assertEqual($node->vid, $node->workbench_moderation['published']->vid, t('Published revision is loaded by default'));
$this
->assertTrue($node->status, t('Published revision has status = 1'));
$this
->drupalLogout();
$this
->drupalGet("node/{$node->nid}");
$this
->assertResponse(200, t('Anonymous users can access the published content'));
}