3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 11:15:42 +00:00

FMCS: throw an error if companies don’t match, updated tests

This commit is contained in:
snipe
2026-06-09 19:08:27 +01:00
parent c44f3319e3
commit b0aa21bee7
5 changed files with 24 additions and 22 deletions

View File

@ -13,7 +13,6 @@ trait ProvidesDataForFullMultipleCompanySupportTesting
yield "User in a company should result in user's company_id being used" => [
function () {
$jedi = Company::factory()->create();
$sith = Company::factory()->create();
$luke = User::factory()->for($jedi)
->createAccessories()
->createAssets()
@ -24,10 +23,9 @@ trait ProvidesDataForFullMultipleCompanySupportTesting
return [
'actor' => $luke,
'company_attempting_to_associate' => $sith,
'company_attempting_to_associate' => $jedi,
'assertions' => function ($model) use ($jedi) {
// Sith is not in Luke's pivot (he belongs only to Jedi), so the
// submitted company is rejected and his single pivot company is used.
// Luke submits his own company (Jedi) — it is in his pivot so it is honoured.
self::assertEquals($jedi->id, $model->company_id);
},
];