createAdminUser(['name' => 'testRegistration Admin']); /** @var UserService $userSvc */ $userSvc = app(UserService::class); $this->updateSetting('pilots.auto_accept', true); $attrs = factory(User::class)->make()->makeVisible(['api_key', 'name', 'email'])->toArray(); $attrs['password'] = Hash::make('secret'); $user = $userSvc->createUser($attrs); $this->assertEquals(UserState::ACTIVE, $user->state); Notification::assertSentTo([$admin], AdminUserRegistered::class); Notification::assertNotSentTo([$user], AdminUserRegistered::class); } }