You are here

public function PublishContentWebTestBase::testNoPublishPermissionByOwner in Publish Content 7

Check no publish permission by node owner.

File

tests/publishcontent.test, line 227
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 testNoPublishPermissionByOwner() {
  $web_user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->drupalLogin($web_user);
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'uid' => $web_user->uid,
    'status' => 1,
  ));
  $this
    ->assertCurrentUserCannotPublish($node);
  $this
    ->assertCurrentUserCannotUnpublish($node);
  $this
    ->setNodeStatus($node, 0);
  $this
    ->assertNodeOperationAccess($node->nid, 'view', 403, 'Node is not accessible by its owner when unpublished.');
}