function AccessManagerTest::setupAccessArgumentsResolverFactory

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

Add default expectations to the access arguments resolver factory.

4 calls to AccessManagerTest::setupAccessArgumentsResolverFactory()
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::testCheckException in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests that an access checker throws an exception for not allowed values.
AccessManagerTest::testCheckNamedRoute in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Tests the checkNamedRoute method.

File

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

Class

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

Namespace

Drupal\Tests\Core\Access

Code

protected function setupAccessArgumentsResolverFactory($constraint = NULL) {
    if (!isset($constraint)) {
        $constraint = $this->any();
    }
    return $this->argumentsResolverFactory
        ->expects($constraint)
        ->method('getArgumentsResolver')
        ->willReturnCallback(function ($route_match, $account) {
        $resolver = $this->createMock('Drupal\\Component\\Utility\\ArgumentsResolverInterface');
        $resolver->expects($this->any())
            ->method('getArguments')
            ->willReturnCallback(function ($callable) use ($route_match) {
            return [
                $route_match->getRouteObject(),
            ];
        });
        return $resolver;
    });
}

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