You are here

public function AccessManagerTest::testCheckWithNullAccount in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php \Drupal\Tests\Core\Access\AccessManagerTest::testCheckWithNullAccount()
  2. 9 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 232
Contains \Drupal\Tests\Core\Access\AccessManagerTest.

Class

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

Namespace

Drupal\Tests\Core\Access

Code

public function testCheckWithNullAccount() {
  $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));
}