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,39 @@
<?php
namespace Tests\Feature\Auth;
use App\Models\User;
use Tests\Facades\UserFactory;
use Tests\TestCase;
class RefreshTest extends TestCase
{
private const URI = 'auth/refresh';
private const TEST_URI = 'auth/me';
private User $user;
protected function setUp(): void
{
parent::setUp();
$this->user = UserFactory::withTokens()->create();
}
public function test_refresh(): void
{
$token = cache("testing:{$this->user->id}:tokens");
$this->assertNotEmpty($token);
$this->assertNotEmpty($token[0]);
$this->assertNotEmpty($token[0]['token']);
$this->actingAs($token[0]['token'])->get(self::TEST_URI)->assertOk();
$response = $this->actingAs($token[0]['token'])->postJson(self::URI);
$response->assertOk();
$this->actingAs($token[0]['token'])->get(self::TEST_URI)->assertUnauthorized();
}
}