public function PublishContentWebTestBase::testPublishNotUnpublish in Publish Content 7
Test the combination of publish but not unpublish permissions.
File
- tests/
publishcontent.test, line 270 - 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 testPublishNotUnpublish() {
$type = 'page';
$this
->enablePublishContentForContentType($type);
$web_user = $this
->drupalCreateUser(array(
'access content',
'publish editable ' . $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' => 0,
));
$this
->drupalGet('node/' . $node->nid . '/edit');
$this
->assertResponse(200);
$this
->assertCurrentUserCanPublish($node);
$this
->assertCurrentUserCannotUnpublish($node);
}