value() . ' : ' . UserRole::Admin->label(); // WHEN / THEN $command = $this->artisan('uwil:user:create'); Assert::isInstanceOf($command, PendingCommand::class); $command ->expectsQuestion('What is the firstname?', 'Alice') ->expectsQuestion('What is the lastname?', 'Martin') ->expectsQuestion('What is the email?', 'alice.martin@ldc.fr') ->expectsQuestion('What is the password?', 'Str0ng!Password') ->expectsQuestion('Confirm : What is the password?', 'Str0ng!Password') ->expectsQuestion('What is the role ?', $roleChoice) ->expectsOutput('User created.') ->assertSuccessful() ->execute(); $user = User::query()->where('email', 'alice.martin@ldc.fr')->first(); expect($user)->not->toBeNull() ->and($user?->firstname)->toBe('Alice') ->and($user?->lastname)->toBe('Martin') ->and($user?->role)->toBe(UserRole::Admin) ->and(Hash::check('Str0ng!Password', (string) $user?->password))->toBeTrue(); });