You are here

public function M4032404TestCaseTest::testM4032404Test404 in 403 to 404 8

Tests 404 Not Found response when hitting /admin.

File

tests/src/Functional/M4032404TestCaseTest.php, line 40

Class

M4032404TestCaseTest
Tests the functionality of the m4032404 module.

Namespace

Drupal\Tests\m4032404\Functional

Code

public function testM4032404Test404() {
  $this
    ->drupalGet('admin');
  $this
    ->assertResponse(404, 'Anonymous users get a 404 instead of a 403.');
  $this
    ->drupalGet('user/1');
  $this
    ->assertResponse(404, 'User gets a 404 instead of a 403 on non-admin paths.');

  // Set admin-only.
  $this
    ->config('m4032404.settings')
    ->set('admin_only', TRUE)
    ->save();
  $this
    ->drupalGet('user/1');
  $this
    ->assertResponse(403, 'User gets a 403 on non-admin paths when admin-only is configured.');
}