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:
@ -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);
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user