Skip to content

A free open source IT asset/license management system

Scaffold accessory checkout tests for api

Marcus Mooree5d3df7d2411
diff --git a/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php b/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
new file mode 100644
index 0000000000..14ac9da1bf
--- /dev/null
+++ b/tests/Feature/Api/Accessories/AccessoryCheckoutTest.php
@@ -0,0 +1,64 @@
+<?php
+
+namespace Tests\Feature\Api\Accessories;
+
+use App\Models\Accessory;
+use App\Models\User;
+use App\Notifications\CheckoutAccessoryNotification;
+use Illuminate\Support\Facades\Notification;
+use Tests\Support\InteractsWithSettings;
+use Tests\TestCase;
+
+class AccessoryCheckoutTest extends TestCase
+{
+ use InteractsWithSettings;
+
+ public function testCheckingOutAccessoryRequiresCorrectPermission()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testValidation()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testAccessoryMustBeAvailableWhenCheckingOut()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testAccessoryCanBeCheckedOut()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testUserSentNotificationUponCheckout()
+ {
+ $this->markTestIncomplete();
+
+ $this->withoutExceptionHandling();
+
+ Notification::fake();
+
+ $accessory = Accessory::factory()->requiringAcceptance()->create();
+ $user = User::factory()->create();
+
+ $this->actingAsForApi(User::factory()->checkoutAccessories()->create())
+ ->postJson(route('api.accessories.checkout', $accessory), [
+ 'assigned_to' => $user->id,
+ ]);
+
+ Notification::assertSentTo($user, CheckoutAccessoryNotification::class);
+ }
+
+ public function testActionLogCreatedUponCheckout()
+ {
+ $this->markTestIncomplete();
+ }
+
+ public function testUserSentEulaUponCheckoutIfAcceptanceRequired()
+ {
+ $this->markTestIncomplete();
+ }
+}
diff --git a/tests/Feature/Checkouts/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/AccessoryCheckoutTest.php
index df89c5037b..daa9b5fb61 100644
--- a/tests/Feature/Checkouts/AccessoryCheckoutTest.php
+++ b/tests/Feature/Checkouts/AccessoryCheckoutTest.php
@@ -3,7 +3,6 @@
namespace Tests\Feature\Checkouts;
use App\Models\Accessory;
-use App\Models\Actionlog;
use App\Models\User;
use App\Notifications\CheckoutAccessoryNotification;
use Illuminate\Support\Facades\Notification;