You are here

function PublishContentWebCaseTest::assert_current_user_can_publish_node in Publish Content 6

Same name and namespace in other branches
  1. 5.2 tests/publishcontent.test \PublishContentWebCaseTest::assert_current_user_can_publish_node()
2 calls to PublishContentWebCaseTest::assert_current_user_can_publish_node()
PublishContentWebCaseTest::testDoPublishAndUnpublishNotByNodeOwner in tests/publishcontent.test
PublishContentWebCaseTest::testDoPublishByNodeOwner in tests/publishcontent.test

File

tests/publishcontent.test, line 86
Unit tests for Publish Content module. prerequesite: make sure that 'authenticated user' does not have any access like 'publish [content type] content' or 'unpublish [content type] content'

Class

PublishContentWebCaseTest
@file Unit tests for Publish Content module. prerequesite: make sure that 'authenticated user' does not have any access like 'publish [content type] content' or 'unpublish [content type] content'

Code

function assert_current_user_can_publish_node(&$node) {
  $this
    ->assertEqual($node->status, 1, 'pre-requesite: status MUST be 1');
  $this
    ->publishcontent_do_operation($node->nid, 'publish', 1, 'node should be still published');
  $this
    ->assert_access_node($node, 'node MUST BE viewable');
  $this
    ->set_node_status($node, 0);
  $this
    ->assert_access_node($node, 'node MUST BE viewable even if unpublished');
  $this
    ->publishcontent_do_operation($node->nid, 'publish', 1, 'node should be now published');
  $this
    ->assertText(_publishcontent_get_message($node->nid, $node->title, TRUE), 'drupal_set_message not working for publish.');
  $this
    ->set_node_status($node, 1, 'post-requesite: status MUST be 1');
}