public function SaveDraftTestCase::testNodeSave in Save Draft 6.2
Same name and namespace in other branches
- 7 save_draft.test \SaveDraftTestCase::testNodeSave()
Make sure nodes save with the right publication status.
File
- ./
save_draft.test, line 36
Class
Code
public function testNodeSave() {
// Publish a node, and make sure it's published.
$edit = $this
->getNodeArray();
$this
->drupalPost('node/add/story', $edit, t('Publish'));
$node = $this
->drupalGetNodeByTitle($edit[$this->title_key]);
$this
->assertEqual($node->status, 1, t('Node saved correctly.'));
// Unpublish it, and make sure it's unpublished.
$this
->drupalPost("node/{$node->nid}/edit", array(), t('Save as unpublish'));
$node = node_load($node->nid, NULL, TRUE);
$this
->assertEqual($node->status, 0, t('Node unpublished correctly.'));
// Save a new node as a draft, and make sure it's unpublished.
$edit = $this
->getNodeArray();
$this
->drupalPost('node/add/story', $edit, t('Save as Draft'));
$node = $this
->drupalGetNodeByTitle($edit[$this->title_key]);
$this
->assertEqual($node->status, 0, t('Node saved correctly as draft.'));
// Publish the node, and make sure it's published.
$this
->drupalPost("node/{$node->nid}/edit", array(), t('Save Changes'));
$node = node_load($node->nid, NULL, TRUE);
$this
->assertEqual($node->status, 1, t('Node published correctly.'));
}