diff --git a/tests/RegistrationTest.php b/tests/RegistrationTest.php index bf146781..f539000e 100644 --- a/tests/RegistrationTest.php +++ b/tests/RegistrationTest.php @@ -5,6 +5,7 @@ namespace Tests; use App\Events\UserRegistered; use App\Models\Enums\UserState; use App\Models\User; +use App\Services\UserService; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Notification; @@ -23,11 +24,12 @@ class RegistrationTest extends TestCase Event::fake(); Notification::fake(); - $userSvc = app('App\Services\UserService'); + /** @var UserService $userSvc */ + $userSvc = app(UserService::class); setting('pilots.auto_accept', true); - $attrs = factory(User::class)->make()->toArray(); + $attrs = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $attrs['password'] = Hash::make('secret'); $user = $userSvc->createUser($attrs); diff --git a/tests/UserTest.php b/tests/UserTest.php index 20e1d843..0fcfbf6b 100644 --- a/tests/UserTest.php +++ b/tests/UserTest.php @@ -291,13 +291,13 @@ class UserTest extends TestCase */ public function testUserPilotIdAdded() { - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $user = $this->userSvc->createUser($new_user); $this->assertEquals($user->id, $user->pilot_id); // Add a second user - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $user2 = $this->userSvc->createUser($new_user); $this->assertEquals($user2->id, $user2->pilot_id); @@ -313,11 +313,11 @@ class UserTest extends TestCase public function testUserPilotDeleted() { - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $admin_user = $this->userSvc->createUser($new_user); - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $user = $this->userSvc->createUser($new_user); $this->assertEquals($user->id, $user->pilot_id); @@ -335,11 +335,11 @@ class UserTest extends TestCase public function testUserPilotDeletedWithPireps() { - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $admin_user = $this->userSvc->createUser($new_user); - $new_user = factory(User::class)->make()->toArray(); + $new_user = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $new_user['password'] = Hash::make('secret'); $user = $this->userSvc->createUser($new_user); $this->assertEquals($user->id, $user->pilot_id);