first commit

This commit is contained in:
Noor E Ilahi
2026-01-09 12:54:53 +05:30
commit 7ccf44f7da
1070 changed files with 113036 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace Tests\Feature\Auth;
use App\Models\User;
use Tests\Facades\UserFactory;
use Tests\TestCase;
class LogoutFromAllTest extends TestCase
{
private const URI = 'auth/logout-from-all';
private const TEST_URI = 'auth/me';
private User $user;
protected function setUp(): void
{
parent::setUp();
$this->user = UserFactory::withTokens(4)->create();
}
public function test_logout_from_all(): void
{
$tokens = cache("testing:{$this->user->id}:tokens");
$this->assertNotEmpty($tokens);
foreach ($tokens as $token) {
$this->actingAs($token['token'])->get(self::TEST_URI)->assertOk();
}
$response = $this->actingAs($tokens[0]['token'])->postJson(self::URI);
$response->assertOk();
foreach ($tokens as $token) {
$this->actingAs($token['token'])->get(self::TEST_URI)->assertUnauthorized();
}
}
public function test_unauthorized(): void
{
$response = $this->postJson(self::URI);
$response->assertUnauthorized();
}
}