Skip to content

A free open source IT asset/license management system

Complete a scenario

Marcus Moore8ca882d1c8b8
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php
index 74ba2cf6db..b1697d7c6c 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 22afb966b4..34183650cb 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)