function PageViewTest::testPageView in SimpleTest 6
Same name and namespace in other branches
- 5 tests/page_view.test \PageViewTest::testPageView()
File
- tests/
page_view.test, line 16
Class
Code
function testPageView() {
/* Prepare a node to view */
global $user;
$node = $this
->drupalCreateNode();
$this
->assertNotNull(node_load($node->nid), 'Node created');
/* Tries to edit with anonymous user */
$html = $this
->drupalGet("node/{$node->nid}/edit");
$this
->assertResponse(403);
/* Prepare a user to request the node view */
$test_user = $this
->drupalCreateUserRolePerm(array(
'access content',
));
$this
->drupalLoginUser($test_user);
$html = $this
->drupalGet("node/{$node->nid}/edit");
$this
->assertResponse(403);
$test_user = $this
->drupalCreateUserRolePerm(array(
'administer nodes',
));
//TODO: Add edit page attempt with administer nodes user
node_delete($node->nid);
}