You are here

public function PublishContentWebTestBase::testNotPublishUnpublish in Publish Content 7

Test the combination of unpublish but not publish.

File

tests/publishcontent.test, line 301
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 testNotPublishUnpublish() {
  $type = 'page';
  $this
    ->enablePublishContentForContentType($type);
  $web_user = $this
    ->drupalCreateUser(array(
    'access content',
    'unpublish any ' . $type . ' content',
    'view own unpublished content',
    'edit own ' . $type . ' content',
  ));
  $this
    ->drupalLogin($web_user);
  $node = $this
    ->drupalCreateNode(array(
    'type' => $type,
    'uid' => $web_user->uid,
    'status' => 1,
  ));
  $this
    ->assertCurrentUserCannotPublish($node);
  $this
    ->assertCurrentUserCanUnpublish($node);
}