public function RolesNegotiationFunctionalTest::testRequestWithMissingScope in Simple OAuth (OAuth2) & OpenID Connect 8.3
Same name and namespace in other branches
- 8.2 simple_oauth_extras/tests/src/Functional/RolesNegotiationFunctionalTest.php \Drupal\Tests\simple_oauth_extras\Functional\RolesNegotiationFunctionalTest::testRequestWithMissingScope()
Test access to own unpublished node but with missing scope.
File
- simple_oauth_extras/
tests/ src/ Functional/ RolesNegotiationFunctionalTest.php, line 242
Class
- RolesNegotiationFunctionalTest
- @group simple_oauth_extras
Namespace
Drupal\Tests\simple_oauth_extras\FunctionalCode
public function testRequestWithMissingScope() {
$access_token = $this
->getAccessToken();
$response = $this
->get($this->tokenTestUrl, [
'query' => [
'_format' => 'json',
],
'headers' => [
'Authorization' => 'Bearer ' . $access_token,
],
]);
$parsed_response = Json::decode((string) $response
->getBody());
$this
->assertEquals($this->user
->id(), $parsed_response['id']);
$this
->assertEquals([
'authenticated',
'oof',
], $parsed_response['roles']);
$this
->assertFalse($parsed_response['permissions']['view own simple_oauth entities']['access']);
}