mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
User management (#185)
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Commands;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
@ -27,7 +28,36 @@ public function test_create_user(): void
|
||||
$user = User::query()->where('email', 'john@doe.com')->first();
|
||||
|
||||
$this->assertDatabaseHas('projects', [
|
||||
'name' => 'default',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_create_user_and_project(): void
|
||||
{
|
||||
Project::query()->delete();
|
||||
User::query()->delete();
|
||||
|
||||
$this->artisan('user:create', [
|
||||
'name' => 'John Doe',
|
||||
'email' => 'john@doe.com',
|
||||
'password' => 'password',
|
||||
])->expectsOutput('User created!');
|
||||
|
||||
$this->assertDatabaseHas('users', [
|
||||
'name' => 'John Doe',
|
||||
'email' => 'john@doe.com',
|
||||
]);
|
||||
|
||||
/** @var User $user */
|
||||
$user = User::query()->where('email', 'john@doe.com')->first();
|
||||
|
||||
$this->assertDatabaseHas('projects', [
|
||||
'name' => 'default',
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('user_project', [
|
||||
'user_id' => $user->id,
|
||||
'project_id' => $user->refresh()->current_project_id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user