You are here

public function PageExampleTest::pageExampleVerifyNoAccess in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/page_example/tests/src/Functional/PageExampleTest.php \Drupal\Tests\page_example\Functional\PageExampleTest::pageExampleVerifyNoAccess()

Verify that current user has no access to page.

Parameters

string $url: URL to verify.

1 call to PageExampleTest::pageExampleVerifyNoAccess()
PageExampleTest::testPageExample in page_example/tests/src/Functional/PageExampleTest.php
Main test.

File

page_example/tests/src/Functional/PageExampleTest.php, line 68

Class

PageExampleTest
Creates page and render the content based on the arguments passed in the URL.

Namespace

Drupal\Tests\page_example\Functional

Code

public function pageExampleVerifyNoAccess($url) {

  // Test that page returns 403 Access Denied.
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(403);
}