function AccessManagerTest::setupAccessChecker

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php \Drupal\Tests\Core\Access\AccessManagerTest::setupAccessChecker()
  2. 8.9.x core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php \Drupal\Tests\Core\Access\AccessManagerTest::setupAccessChecker()
  3. 10 core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php \Drupal\Tests\Core\Access\AccessManagerTest::setupAccessChecker()

Adds a default access check service to the container and the access manager.

6 calls to AccessManagerTest::setupAccessChecker()
AccessManagerTest::testCheck in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests \Drupal\Core\Access\AccessManager::check().
AccessManagerTest::testCheckConjunctions in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests \Drupal\Core\Access\AccessManager::check() with conjunctions.
AccessManagerTest::testCheckNamedRoute in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests the checkNamedRoute method.
AccessManagerTest::testCheckNamedRouteWithNonExistingRoute in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests checkNamedRoute given an invalid/non existing route name.
AccessManagerTest::testCheckWithNullAccount in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests \Drupal\Core\Access\AccessManager::check() with no account specified.

... See full list

File

core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php, line 522

Class

AccessManagerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Access%21AccessManager.php/class/AccessManager/11.x" title="Attaches access check services to routes and runs them on request." class="local">\Drupal\Core\Access\AccessManager</a> @group Access

Namespace

Drupal\Tests\Core\Access

Code

protected function setupAccessChecker() {
    $this->container
        ->register('test_access_default', DefaultAccessCheck::class);
    $this->checkProvider
        ->addCheckService('test_access_default', 'access', [
        '_access',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.