function PublishContentWebCaseTest::testDoPublishAndUnpublishNotByNodeOwner in Publish Content 6
File
- tests/
publishcontent.test, line 185 - 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 testDoPublishAndUnpublishNotByNodeOwner() {
$type = 'page';
$node = $this
->drupalCreateNode(array(
'type' => $type,
'uid' => 0,
'status' => 1,
));
$this
->drupalLogin($this
->drupalCreateUser(array(
'publish any ' . $type . ' content',
)));
$this
->assert_current_user_can_publish_node($node);
$this
->assert_current_user_cannot_unpublish_node($node);
$this
->drupalLogin($this
->drupalCreateUser(array(
'unpublish any ' . $type . ' content',
)));
$this
->assert_current_user_cannot_publish_node($node);
$this
->assert_current_user_can_unpublish_node($node);
$this
->drupalLogin($this
->drupalCreateUser(array(
'publish any content',
)));
$this
->assert_current_user_can_publish_node($node);
$this
->assert_current_user_cannot_unpublish_node($node);
$this
->drupalLogin($this
->drupalCreateUser(array(
'unpublish any content',
)));
$this
->assert_current_user_cannot_publish_node($node);
$this
->assert_current_user_can_unpublish_node($node);
}