public function RolesNegotiationFunctionalTest::testRequestWithMissingScope in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.3 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 272
Class
- RolesNegotiationFunctionalTest
- @group simple_oauth_extras
Namespace
Drupal\Tests\simple_oauth_extras\FunctionalCode
public function testRequestWithMissingScope() {
$access_token = $this
->getAccessToken();
$response = $this
->request('GET', $this->tokenTestUrl, [
'query' => [
'_format' => 'json',
],
'headers' => [
'Authorization' => 'Bearer ' . $access_token,
],
]);
$parsed_response = Json::decode($response
->getBody()
->getContents());
$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']);
}