You are here

public function PublishContentWebTestBase::testNoPermissionAndNotOwner in Publish Content 7

Check publishcontent module does not interfere with the normal Drupal.

File

tests/publishcontent.test, line 249
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 testNoPermissionAndNotOwner() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'uid' => 0,
    'status' => 1,
  ));
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'access content',
  )));
  $this
    ->assertCurrentUserCannotPublish($node);
  $this
    ->assertCurrentUserCannotUnpublish($node);
  $this
    ->setNodeStatus($node, 0);
  $this
    ->assertNodeOperationAccess($node->nid, 'view', 403, 'Node is not viewable by non owner when unpublished by a user without publish or unpublish permissions');
}