Mercurial > hg > isophonics-drupal-site
comparison core/modules/node/tests/src/Functional/PageViewTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\node\Functional; | |
4 | |
5 use Drupal\node\Entity\Node; | |
6 | |
7 /** | |
8 * Create a node and test edit permissions. | |
9 * | |
10 * @group node | |
11 */ | |
12 class PageViewTest extends NodeTestBase { | |
13 /** | |
14 * Tests an anonymous and unpermissioned user attempting to edit the node. | |
15 */ | |
16 public function testPageView() { | |
17 // Create a node to view. | |
18 $node = $this->drupalCreateNode(); | |
19 $this->assertTrue(Node::load($node->id()), 'Node created.'); | |
20 | |
21 // Try to edit with anonymous user. | |
22 $this->drupalGet("node/" . $node->id() . "/edit"); | |
23 $this->assertResponse(403); | |
24 | |
25 // Create a user without permission to edit node. | |
26 $web_user = $this->drupalCreateUser(['access content']); | |
27 $this->drupalLogin($web_user); | |
28 | |
29 // Attempt to access edit page. | |
30 $this->drupalGet("node/" . $node->id() . "/edit"); | |
31 $this->assertResponse(403); | |
32 | |
33 // Create user with permission to edit node. | |
34 $web_user = $this->drupalCreateUser(['bypass node access']); | |
35 $this->drupalLogin($web_user); | |
36 | |
37 // Attempt to access edit page. | |
38 $this->drupalGet("node/" . $node->id() . "/edit"); | |
39 $this->assertResponse(200); | |
40 } | |
41 | |
42 } |