function AuthenticationManagerTest::testDefaultFilter

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php \Drupal\Tests\Core\Authentication\AuthenticationManagerTest::testDefaultFilter()
  2. 8.9.x core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php \Drupal\Tests\Core\Authentication\AuthenticationManagerTest::testDefaultFilter()
  3. 11.x core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php \Drupal\Tests\Core\Authentication\AuthenticationManagerTest::testDefaultFilter()

@covers ::defaultFilter
@covers ::applyFilter

@dataProvider providerTestDefaultFilter

File

core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php, line 28

Class

AuthenticationManagerTest
@coversDefaultClass \Drupal\Core\Authentication\AuthenticationManager[[api-linebreak]] @group Authentication

Namespace

Drupal\Tests\Core\Authentication

Code

public function testDefaultFilter($applies, $has_route, $auth_option, $provider_id, $global) : void {
  $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));
}

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