public function OpenIdConnectSessionTest::testSaveDestinationUserPath in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x tests/src/Unit/OpenIdConnectSessionTest.php \Drupal\Tests\openid_connect\Unit\OpenIdConnectSessionTest::testSaveDestinationUserPath()
Test the saveDestination() method with the /user/login path.
File
- tests/
src/ Unit/ OpenIdConnectSessionTest.php, line 98
Class
- OpenIdConnectSessionTest
- @coversDefaultClass \Drupal\openid_connect\OpenIDConnectSession @group openid_connect
Namespace
Drupal\Tests\openid_connect\UnitCode
public function testSaveDestinationUserPath() : void {
// Setup our expected results.
$expectedSession = $this
->getExpectedSessionArray('/user', self::TEST_QUERY);
// Mock the getPath method with the user path.
$this->currentPath
->expects($this
->once())
->method('getPath')
->willReturn(self::TEST_USER_PATH);
// Create a class to test with.
$session = new OpenIDConnectSession($this->currentPath, $this->requestStack);
// Call the saveDestination method.
$session
->saveDestination();
// Assert the $_SESSION matches our expectations.
$this
->assertArrayEquals($expectedSession, $_SESSION);
}