You are here

public function SimpleOauthAuthenticationTest::testHasTokenValue in Simple OAuth (OAuth2) & OpenID Connect 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::testHasTokenValue()
  2. 8.2 tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::testHasTokenValue()
  3. 5.x tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php \Drupal\Tests\simple_oauth\Unit\Authentication\Provider\SimpleOauthAuthenticationTest::testHasTokenValue()

@covers ::applies

@dataProvider hasTokenValueProvider

File

tests/src/Unit/Authentication/Provider/SimpleOauthAuthenticationTest.php, line 53

Class

SimpleOauthAuthenticationTest
@coversDefaultClass \Drupal\simple_oauth\Authentication\Provider\SimpleOauthAuthenticationProvider @group simple_oauth

Namespace

Drupal\Tests\simple_oauth\Unit\Authentication\Provider

Code

public function testHasTokenValue($authorization, $has_token) {
  $request = new Request();
  if ($authorization !== NULL) {
    $request->headers
      ->set('Authorization', $authorization);
  }
  $this
    ->assertSame($has_token, $this->provider
    ->applies($request));
  $this
    ->assertSame($has_token ? RequestPolicyInterface::DENY : NULL, $this->oauthPageCacheRequestPolicy
    ->check($request));
}