create profile api's with tests
This commit is contained in:
38
tests/Feature/V3/Profile/InfoTest.php
Normal file
38
tests/Feature/V3/Profile/InfoTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user