function WorkbenchModerationUnpublishTestCase::testUnpublish in Workbench Moderation 7
Same name and namespace in other branches
- 7.3 tests/workbench_moderation.test \WorkbenchModerationUnpublishTestCase::testUnpublish()
File
- tests/
workbench_moderation.test, line 262 - Tests for workbench_moderation.module.
Class
Code
function testUnpublish() {
// Create a new node and publish it immediately. Assumes that
// WorkbenchModerationPublishFromNodeFormTestCase passes.
$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']);
// Unpublish the node via the unpublish confirmation form.
$this
->drupalPost("node/{$node->nid}/moderation/{$node->vid}/unpublish", array(), t('Unpublish'));
$unpublished_node = node_load($node->nid, FALSE, TRUE);
$this
->assertFalse($unpublished_node->status, t('The node is not published.'));
$this
->assertFalse(isset($unpublished_node->workbench_moderation['published']), t('Workbench moderation has no published revision.'));
}