public function BiblioPageViewTestCase::testBiblioPageView in Bibliography Module 7
Same name and namespace in other branches
- 7.2 tests/biblio.test \BiblioPageViewTestCase::testBiblioPageView()
Creates a node and an anonymous and unpermissioned user attempt to edit it.
File
- tests/
BiblioPageViewTestCase.test, line 29
Class
- BiblioPageViewTestCase
- Test page view permissions.
Code
public function testBiblioPageView() {
// Create a node to view.
$node = $this
->createNode('101');
$this
->assertTrue(node_load($node->nid), t('Node created.'));
// Try to edit with anonymous user.
$html = $this
->drupalGet("node/{$node->nid}/edit");
$this
->assertResponse(403);
// Create a user without permission to edit node.
$web_user = $this
->drupalCreateUser(array(
'access content',
));
$this
->drupalLogin($web_user);
// Attempt to access edit page.
$this
->drupalGet("node/{$node->nid}/edit");
$this
->assertResponse(403);
// Create user with permission to edit node.
$web_user = $this
->drupalCreateUser(array(
'edit any biblio content',
));
$this
->drupalLogin($web_user);
// Attempt to access edit page.
$this
->drupalGet("node/{$node->nid}/edit");
$this
->assertResponse(200);
}