Files
backend/tests/Feature/V3/Profile/InfoTest.php

39 lines
1000 B
PHP

<?php
namespace Tests\Feature\V3\Profile;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class InfoTest extends TestCase
{
use RefreshDatabase, WithFaker;
public function test_user_info_returns_successfully(): void
{
$user = User::factory()->create();
$this->actingAs($user);
$response = $this->get(route('v3.profile.info'));
$response->assertStatus(200);
$response->assertExactJson([
'data' => [
'username' => $user->username,
'first_name' => $user->first_name,
'last_name' => $user->last_name,
'name' => $user->name,
'last_login' => $user->last_login,
'major' => $user->major,
'degree' => $user->degree,
'mobile' => $user->mobile,
'avatar' => $user->avatar,
]
]);
}
}