AccessManager example

$map[] = ['test_route_3', [], '/test-route-3'];
    $map[] = ['test_route_4', ['value' => 'example'], '/test-route-4/example'];

    $this->paramConverter = $this->createMock('Drupal\Core\ParamConverter\ParamConverterManagerInterface');

    $this->account = $this->createMock('Drupal\Core\Session\AccountInterface');
    $this->currentUser = $this->createMock('Drupal\Core\Session\AccountInterface');
    $this->argumentsResolverFactory = $this->createMock('Drupal\Core\Access\AccessArgumentsResolverFactoryInterface');
    $this->checkProvider = new CheckProvider();
    $this->checkProvider->setContainer($this->container);

    $this->accessManager = new AccessManager($this->routeProvider, $this->paramConverter, $this->argumentsResolverFactory, $this->currentUser, $this->checkProvider);
  }

  /** * Tests \Drupal\Core\Access\AccessManager::setChecks(). */
  public function testSetChecks() {
    // Check setChecks without any access checker defined yet.     $this->checkProvider->setChecks($this->routeCollection);

    foreach ($this->routeCollection->all() as $route) {
      $this->assertNull($route->getOption('_access_checks'));
    }
Home | Imprint | This part of the site doesn't use cookies.