You are here

public function AdsTxtTest::testAdsTxtUserNoAccess in AdsTxt 8

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

File

tests/src/Functional/AdsTxtTest.php, line 45

Class

AdsTxtTest
Tests functionality of configured ads.txt files.

Namespace

Drupal\Tests\adstxt\Functional

Code

public function testAdsTxtUserNoAccess() {

  // Create user.
  $this->normal_user = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $this
    ->drupalLogin($this->normal_user);
  $this
    ->drupalGet('admin/config/system/adstxt');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $this
    ->assertSession()
    ->fieldNotExists('edit-adstxt-content');
}