AuthenticationManager example

/** * @covers ::defaultFilter * @covers ::applyFilter * * @dataProvider providerTestDefaultFilter */
  public function testDefaultFilter($applies$has_route$auth_option$provider_id$global) {
    $auth_provider = $this->createMock('Drupal\Core\Authentication\AuthenticationProviderInterface');
    $auth_collector = new AuthenticationCollector();
    $auth_collector->addProvider($auth_provider$provider_id, 0, $global);
    $authentication_manager = new AuthenticationManager($auth_collector);

    $request = new Request();
    if ($has_route) {
      $route = new Route('/example');
      if ($auth_option) {
        $route->setOption('_auth', $auth_option);
      }
      $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, $route);
    }

    $this->assertSame($applies$authentication_manager->appliesToRoutedRequest($request, FALSE));
  }
Home | Imprint | This part of the site doesn't use cookies.