Mercurial > hg > isophonics-drupal-site
view core/modules/node/tests/src/Functional/PageViewTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Tests\node\Functional; use Drupal\node\Entity\Node; /** * Create a node and test edit permissions. * * @group node */ class PageViewTest extends NodeTestBase { /** * Tests an anonymous and unpermissioned user attempting to edit the node. */ public function testPageView() { // Create a node to view. $node = $this->drupalCreateNode(); $this->assertTrue(Node::load($node->id()), 'Node created.'); // Try to edit with anonymous user. $this->drupalGet("node/" . $node->id() . "/edit"); $this->assertResponse(403); // Create a user without permission to edit node. $web_user = $this->drupalCreateUser(['access content']); $this->drupalLogin($web_user); // Attempt to access edit page. $this->drupalGet("node/" . $node->id() . "/edit"); $this->assertResponse(403); // Create user with permission to edit node. $web_user = $this->drupalCreateUser(['bypass node access']); $this->drupalLogin($web_user); // Attempt to access edit page. $this->drupalGet("node/" . $node->id() . "/edit"); $this->assertResponse(200); } }