Init signature UserTests with AuthTest in one file
This commit is contained in:
parent
631cf4f3c1
commit
94ec0d14b9
@ -2,9 +2,101 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UserTest extends TestCase
|
||||
{
|
||||
//
|
||||
// FIXME: tests should be
|
||||
// grouped and be separated in several files
|
||||
|
||||
public function test_success_get_users(): void
|
||||
{
|
||||
$this->get('/user')
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_success_get_one_user(): void
|
||||
{
|
||||
$user = User::query()->first();
|
||||
|
||||
$this->get('/user/' . $user->id)
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_fail_get_user_not_exists(): void
|
||||
{
|
||||
$this->get('/user/99999999')
|
||||
->assertNotFound();
|
||||
|
||||
// FIXME: Not Fount or Bad request? or any else error?
|
||||
// Maybe parse exception: id is numeric
|
||||
// but in future updates id
|
||||
// will be uuid, it is safer
|
||||
$this->get('/user/sehtrgher')
|
||||
->assertNotFound();
|
||||
}
|
||||
|
||||
// FIXME: below tests should be in AuthTest
|
||||
public function test_user_can_sign_up_with_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_user_cannot_sign_up_with_not_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_user_can_sign_in_with_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_user_cannot_sign_in_with_not_validate_data_or_wrong_credentials(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
// FIXME: above tests should be in AuthTest
|
||||
|
||||
// FIXME: admin tests in separate file
|
||||
public function test_admin_can_create_user_with_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_admin_cannot_create_user_with_not_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_admin_can_update_user_with_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_admin_cannot_update_user_with_not_validate_data(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_admin_can_delete_user_that_exists(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_admin_cannot_delete_user_that_not_exists(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_unauthorized_cannot_do_admin_actions(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function test_user_cannot_do_admin_actions(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user