@@ -183,16 +183,23 @@ public function testAssetCanBeCheckedOut($data)
183183 $ asset = Asset::factory ()->create ();
184184 $ admin = User::factory ()->checkoutAssets ()->create ();
185185
186+ $ defaultFieldsAlwaysIncludedInUIFormSubmission = [
187+ 'assigned_user ' => null ,
188+ 'assigned_asset ' => null ,
189+ 'assigned_location ' => null ,
190+ ];
191+
186192 $ this ->actingAs ($ admin )
187- ->post (route ('hardware.checkout.store ' , $ asset ), [
193+ ->post (route ('hardware.checkout.store ' , $ asset ), array_merge ( $ defaultFieldsAlwaysIncludedInUIFormSubmission , [
188194 'checkout_to_type ' => $ type ,
189- 'assigned_ ' . $ type => $ target ->id ,
195+ // overwrite the value from the default fields set above
196+ 'assigned_ ' . $ type => (string ) $ target ->id ,
190197 'name ' => 'Changed Name ' ,
191- 'status_id ' => $ newStatus ->id ,
198+ 'status_id ' => ( string ) $ newStatus ->id ,
192199 'checkout_at ' => '2024-03-18 ' ,
193200 'expected_checkin ' => '2024-03-28 ' ,
194201 'note ' => 'An awesome note ' ,
195- ]);
202+ ])) ;
196203
197204 $ asset ->refresh ();
198205 $ this ->assertTrue ($ asset ->assignedTo ()->is ($ target ));
0 commit comments