public function NodeaccesssPublishTestCase::testPublishedView in Nodeaccess 7
Test standard, published node visibility.
File
- tests/
nodeaccess_publish.test, line 88 - Tests for the nodeaccess module.
Class
- NodeaccesssPublishTestCase
- Tests the functionality of the nodeaccess module.
Code
public function testPublishedView() {
nodeaccess_set_grants($this->published_node, $this->grant);
// Baseline, should be visible by all users, including anon.
$this
->drupalGet("node/{$this->published_node->nid}");
$this
->assertResponse(200, 'Anonymous user is allowed to view the content.');
// Authenticated User
$this
->drupalLogin($this->basic_user);
$this
->drupalGet("node/{$this->published_node->nid}");
$this
->assertResponse(200, 'Authenticated user is allowed to view the content.');
$this
->drupalLogout();
// Author User
$this
->drupalLogin($this->author_user);
$this
->drupalGet("node/{$this->published_node->nid}");
$this
->assertResponse(200, 'Author user is allowed to view the content.');
$this
->drupalLogout();
// Admin User
$this
->drupalLogin($this->admin_user);
$this
->drupalGet("node/{$this->published_node->nid}");
$this
->assertResponse(200, 'Admin user is allowed to view the content.');
$this
->drupalLogout();
}