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. 10 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 31

Class

AuthenticationManagerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Authentication%21AuthenticationManager.php/class/AuthenticationManager/8.9.x" title="Manager for authentication." class="local">\Drupal\Core\Authentication\AuthenticationManager</a> @group Authentication

Namespace

Drupal\Tests\Core\Authentication

Code

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));
}

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