You are here

public function RobotsTxtBasicTest::testRobotsTxtUserNoAccess in RobotsTxt 8

Checks that a non-administrative user cannot use the configuration page.

File

tests/src/Functional/RobotsTxtBasicTest.php, line 61

Class

RobotsTxtBasicTest
Tests basic functionality of configured robots.txt files.

Namespace

Drupal\Tests\robotstxt\Functional

Code

public function testRobotsTxtUserNoAccess() {

  // Create user.
  $this->normalUser = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $this
    ->drupalLogin($this->normalUser);
  $this
    ->drupalGet('admin/config/search/robotstxt');
  $this
    ->assertSession()
    ->statusCodeEquals(403);

  // The textarea for configuring robots.txt is not shown for users without
  // appropriate permissions.
  $this
    ->assertSession()
    ->fieldNotExists('edit-robotstxt-content');
}