public function PublishContentWebTestBase::assertCanUnpublishFromLinksPage in Publish Content 7
Assert the current user can unpublish a node from the listing test page.
1 call to PublishContentWebTestBase::assertCanUnpublishFromLinksPage()
- PublishContentWebTestBase::testBasicPublishCallback in tests/
publishcontent.test - Test basic publish ability using the publishcontent_test module.
File
- tests/
publishcontent.test, line 193 - Unit tests for Publish Content module.
Class
- PublishContentWebTestBase
- We test to ensure we are not messing up with the default Drupal access for view node i.e. a owner of a node can view it even if unpublished.
Code
public function assertCanUnpublishFromLinksPage($node) {
$status = $node->status;
$this
->setNodeStatus($node, 1, 'Start test with a published node');
$this
->drupalGet('publishcontent-links');
$this
->assertResponse(200);
$this
->assertLink('unpublish-' . $node->nid);
$this
->assertNoLink('publish-' . $node->nid);
$this
->clickLink('unpublish-' . $node->nid);
$this
->assertResponse(200);
// Submit the confirmation form.
$this
->drupalPost($this->url, array(), 'Confirm');
$this
->assertResponse(200);
$this
->assertNodeStatus($node->nid, 0);
$this
->setNodeStatus($node, $status, 'Reset status');
}