You are here

protected function AuthCodeFunctionalTest::getAndValidateCodeFromResponse in Simple OAuth (OAuth2) & OpenID Connect 8.3

Get the code in the response after granting access to scopes.

Return value

mixed

Throws

\Behat\Mink\Exception\ExpectationException

3 calls to AuthCodeFunctionalTest::getAndValidateCodeFromResponse()
AuthCodeFunctionalTest::testAuthCodeGrant in simple_oauth_extras/tests/src/Functional/AuthCodeFunctionalTest.php
Test the valid AuthCode grant.
AuthCodeFunctionalTest::testNon3rdPartyClientAuthCodeGrant in simple_oauth_extras/tests/src/Functional/AuthCodeFunctionalTest.php
Test the valid AuthCode grant if the client is non 3rd party.
AuthCodeFunctionalTest::testRememberClient in simple_oauth_extras/tests/src/Functional/AuthCodeFunctionalTest.php
Tests the remember client functionality.

File

simple_oauth_extras/tests/src/Functional/AuthCodeFunctionalTest.php, line 247

Class

AuthCodeFunctionalTest
@group simple_oauth_extras

Namespace

Drupal\Tests\simple_oauth_extras\Functional

Code

protected function getAndValidateCodeFromResponse() {
  $assert_session = $this
    ->assertSession();
  $session = $this
    ->getSession();
  $assert_session
    ->statusCodeEquals(200);
  $parsed_url = parse_url($session
    ->getCurrentUrl());
  $parsed_query = \GuzzleHttp\Psr7\parse_query($parsed_url['query']);
  $this
    ->assertArrayHasKey('code', $parsed_query);
  return $parsed_query['code'];
}