function AccessManagerTest::testCheckWithNullAccount

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

Tests \Drupal\Core\Access\AccessManager::check() with no account specified.

@covers ::check

File

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

Class

AccessManagerTest
@coversDefaultClass \Drupal\Core\Access\AccessManager @group Access

Namespace

Drupal\Tests\Core\Access

Code

public function testCheckWithNullAccount() : void {
    $this->setupAccessChecker();
    $this->checkProvider
        ->setChecks($this->routeCollection);
    $route = $this->routeCollection
        ->get('test_route_2');
    $route_match = new RouteMatch('test_route_2', $route, [], []);
    // Asserts that the current user is passed to the access arguments resolver
    // factory.
    $this->setupAccessArgumentsResolverFactory()
        ->with($route_match, $this->currentUser, NULL);
    $this->assertTrue($this->accessManager
        ->check($route_match));
}

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