Skip to content

Commit

Permalink
ログアウトに関するユニットテスト。
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-gillingham committed Sep 20, 2023
1 parent 7c63be0 commit 269af66
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tests/Web/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public function testLogoutAndInvalidateOAuth2Session(string $identifier, array $
self::assertEquals($post_login_data['oauth2_refresh_token']['revoked'], $refreshList[0]->isRevoked());

$headers = ['HTTP_AUTHORIZATION' => 'Bearer '.$token];
$this->client->request('POST', 'http://localhost:8080/api/logout', [], [], $headers, null);
$this->client->request('POST', $this->generateUrl('api_logout'), [], [], $headers);

self::assertEquals(200, $this->client->getResponse()->getStatusCode());
self::assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
self::assertEquals('{"success":true}', $this->client->getResponse()->getContent());
Expand Down Expand Up @@ -264,7 +265,7 @@ private function newAccessToken(array $scopes, string $name = '', string $identi
$accessTokenEntity = new AccessToken();
$accessTokenEntity->setIdentifier($identifier);
$accessTokenEntity->setClient($clientEntity);
$accessTokenEntity->setExpiryDateTime($expiryDateTime);
$accessTokenEntity->setExpiryDateTime($expiryDateTime ?? new \DateTimeImmutable('+1 days', new \DateTimeZone('Asia/Tokyo')));
$accessTokenEntity->setUserIdentifier($name !== '' ? $name : 'admin');
$accessTokenEntity->setPrivateKey(new CryptKey(self::$container->getParameter('kernel.project_dir').'/app/PluginData/Api42/oauth/private.key'));

Expand Down

0 comments on commit 269af66

Please sign in to comment.