This commit is contained in:
25
tests/Integration/LogoutTest.php
Normal file
25
tests/Integration/LogoutTest.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Integration;
|
||||
|
||||
use Tests\Support\ApiTestCase;
|
||||
use Tests\Support\DatabaseFixture;
|
||||
|
||||
final class LogoutTest extends ApiTestCase
|
||||
{
|
||||
public function testLogoutRevokesToken(): void
|
||||
{
|
||||
$this->loginAs(DatabaseFixture::ADMIN_USERNAME);
|
||||
$token = $this->bearerToken;
|
||||
$this->assertNotNull($token);
|
||||
|
||||
$logout = $this->api('POST', 'logout');
|
||||
$this->assertOk($logout);
|
||||
|
||||
$this->bearerToken = $token;
|
||||
$after = $this->api('GET', 'questionnaires');
|
||||
$this->assertLegacyAuthError($after, 403, 'Invalid or expired token');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user