states('superuser')->create(); Auth::login($admin); $cat = factory(Category::class)->states('asset-category', 'requires-acceptance')->create(); $model = factory(AssetModel::class)->create(['category_id' => $cat->id]); $asset = factory(Asset::class)->create(['model_id' => $model->id]); $user = factory(User::class)->create(); Notification::fake(); $asset->checkOut($user, 1); Notification::assertSentTo($user, CheckoutNotification::class); } public function testAnAssetRequiringAEulaDoesNotExplodeWhenCheckedOutToALocation() { $this->signIn(); $asset = factory(Asset::class)->states('requires-acceptance')->create(); $location = factory(Location::class)->create(); Notification::fake(); $asset->checkOut($location, 1); Notification::assertNotSentTo($location, CheckoutNotification::class); } }