From 8ca882d1c8b8495b2c0f7c6de445eee4931d274a Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 22 May 2024 13:23:49 -0700 Subject: [PATCH] Complete a scenario --- app/Http/Controllers/Api/AssetsController.php | 1 - tests/Feature/Api/Assets/AssetCheckoutTest.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 74ba2cf6d..b1697d7c6 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -829,7 +829,6 @@ class AssetsController extends Controller $error_payload['target_type'] = 'location'; } elseif (request('checkout_to_type') == 'asset') { - // @todo: test this code path $target = Asset::where('id', '!=', $asset_id)->find(request('assigned_asset')); // Override with the asset's location_id if it has one $asset->location_id = (($target) && (isset($target->location_id))) ? $target->location_id : ''; diff --git a/tests/Feature/Api/Assets/AssetCheckoutTest.php b/tests/Feature/Api/Assets/AssetCheckoutTest.php index 22afb966b..34183650c 100644 --- a/tests/Feature/Api/Assets/AssetCheckoutTest.php +++ b/tests/Feature/Api/Assets/AssetCheckoutTest.php @@ -142,7 +142,7 @@ class AssetCheckoutTest extends TestCase ['checkout_type' => $type, 'target' => $target, 'expected_location' => $expectedLocation] = $data(); $newStatus = Statuslabel::factory()->readyToDeploy()->create(); - $asset = Asset::factory()->create(); + $asset = Asset::factory()->forLocation()->create(); $admin = User::factory()->checkoutAssets()->create(); $this->actingAsForApi($admin)