Skip to content

A free open source IT asset/license management system

Add failing test case

Marcus Moore4188849ae17d
diff --git a/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php b/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php
index 389a54dda5..60676f39c1 100644
--- a/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php
+++ b/tests/Feature/Assets/Api/StoreAssetWithFullMultipleCompanySupportTest.php
@@ -35,4 +35,24 @@ class StoreAssetWithFullMultipleCompanySupportTest extends TestCase
$assertions($asset);
}
+
+ #[DataProvider('dataForFullMultipleCompanySupportTesting')]
+ public function testHandlesCompanyIdBeingString($data)
+ {
+ ['actor' => $actor, 'company_attempting_to_associate' => $company, 'assertions' => $assertions] = $data();
+
+ $this->settings->enableMultipleFullCompanySupport();
+
+ $response = $this->actingAsForApi($actor)
+ ->postJson(route('api.assets.store'), [
+ 'asset_tag' => 'random_string',
+ 'company_id' => (string) $company->id,
+ 'model_id' => AssetModel::factory()->create()->id,
+ 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,
+ ]);
+
+ $asset = Asset::withoutGlobalScopes()->findOrFail($response['payload']['id']);
+
+ $assertions($asset);
+ }
}