public function PublishContentWebTestBase::assertCanPublishFromLinksPage in Publish Content 7
Assert the current user can publish a node from the listing test page.
1 call to PublishContentWebTestBase::assertCanPublishFromLinksPage()
- PublishContentWebTestBase::testBasicPublishCallback in tests/
publishcontent.test - Test basic publish ability using the publishcontent_test module.
File
- tests/
publishcontent.test, line 159 - 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 assertCanPublishFromLinksPage($node) {
$status = $node->status;
$this
->setNodeStatus($node, 0, 'Start test with an unpublished node');
$this
->drupalGet('publishcontent-links');
$this
->assertResponse(200);
$this
->assertLink('publish-' . $node->nid);
$this
->assertNoLink('unpublish-' . $node->nid);
$this
->clickLink('publish-' . $node->nid);
$this
->assertResponse(200);
// Submit the confirmation form.
$this
->drupalPost($this->url, array(), 'Confirm');
$this
->assertResponse(200);
$this
->assertNodeStatus($node->nid, 1);
$this
->setNodeStatus($node, $status, 'Reset status');
}