CustomAccessCheck example


  protected $argumentsResolverFactory;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->controllerResolver = $this->createMock('Drupal\Core\Controller\ControllerResolverInterface');
    $this->argumentsResolverFactory = $this->createMock('Drupal\Core\Access\AccessArgumentsResolverFactoryInterface');
    $this->accessChecker = new CustomAccessCheck($this->controllerResolver, $this->argumentsResolverFactory);
  }

  /** * Tests the access method. */
  public function testAccess() {
    $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface');

    $this->controllerResolver->expects($this->exactly(3))
      ->method('getControllerFromDefinition')
      ->willReturnMap([
        [
Home | Imprint | This part of the site doesn't use cookies.