From b17078fffd1a198bb3affe8ffb6f4c05c9c61859 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 28 Nov 2023 22:15:13 -0600 Subject: [PATCH] a couple notes --- app/Http/Requests/StoreAssetRequest.php | 1 + tests/Feature/Api/Assets/AssetStoreTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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