Skip to content

Commit 42eb9da

Browse files
test: add test for state does not match exception and added needed sub claim
1 parent 5216e35 commit 42eb9da

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

tests/Feature/Http/Controllers/LoginControllerResponseTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace MinVWS\OpenIDConnectLaravel\Tests\Feature\Http\Controllers;
66

77
use Illuminate\Http\Client\Request;
8-
use Illuminate\Http\Response;
98
use Illuminate\Support\Facades\Config;
109
use Illuminate\Support\Facades\Http;
1110
use Illuminate\Support\Facades\Session;
@@ -159,18 +158,15 @@ public function testStateDoesNotMatch(): void
159158
->withArgs(function (OpenIDConnectClientException $e) {
160159
return $e->getMessage() === 'Unable to determine state';
161160
})
162-
->once()
163-
->andReturn(new Response('', 400));
161+
->once();
164162
$this->app->instance(ExceptionHandlerInterface::class, $mock);
165163

166164
// Set the current state, which is usually generated and saved in the session before login,
167165
// and sent to the issuer during the login redirect.
168166
Session::put('openid_connect_state', 'some-state');
169167

170168
// We simulate here that the state does not match with the state in the session.
171-
// And that the repsonse of ExceptionHandlerInterface is returned.
172-
$response = $this->getRoute('oidc.login', ['code' => 'some-code', 'state' => 'a-different-state']);
173-
$response->assertStatus(400);
169+
$this->getRoute('oidc.login', ['code' => 'some-code', 'state' => 'a-different-state']);
174170
}
175171

176172
public function testIdTokenSignedWithClientSecret(): void

0 commit comments

Comments
 (0)