diff --git a/app/Http/Requests/StoreAssetRequest.php b/app/Http/Requests/StoreAssetRequest.php index 719dfbb4b3..cea8824775 100644 --- a/app/Http/Requests/StoreAssetRequest.php +++ b/app/Http/Requests/StoreAssetRequest.php @@ -20,6 +20,7 @@ class StoreAssetRequest extends ImageUploadRequest public function prepareForValidation(): void { + // this needed to be added in because the observer fails if `assigned_to` is null :shrug: if ($this->has('assigned_user')) { $assigned_to = $this->assigned_user; } elseif ($this->has('assigned_location')) { diff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.php index 746bea9d8f..ae1d54e424 100644 --- a/tests/Feature/Api/Assets/AssetStoreTest.php +++ b/tests/Feature/Api/Assets/AssetStoreTest.php @@ -72,7 +72,7 @@ class AssetStoreTest extends TestCase $this->assertEquals('2024-06-02', $asset->asset_eol_date); $this->assertEquals('random_string', $asset->asset_tag); // @todo: This isn't in the docs but it's in the controller (should it be removed?) - $this->assertEquals($userAssigned->id, $asset->assigned_to); + $this->assertEquals($userAssigned->id, $asset->assigned_to); //todo: figure this out // @todo: This is not in the docs but it's in the controller $this->assertTrue($asset->company->is($company)); // @todo: this is explicitly set 0 in the controller but they docs say they are customizable