Skip to content

A free open source IT asset/license management system

Handle Match expression does not handle remaining value phpstan

snipe746b7758a416
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index 72e652848e..373b1479a8 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -1843,6 +1843,7 @@ class Helper
'Components' => route('components.index'),
'Consumables' => route('consumables.index'),
'Maintenances' => route('maintenances.index'),
+ default => route('home'),
};
// #15214: preserve query-string filters when the user came
@@ -1868,6 +1869,7 @@ class Helper
'Accessories' => redirect()->route('accessories.show', $id ?? $item_id),
'Components' => redirect()->route('components.show', $id ?? $item_id),
'Consumables' => redirect()->route('consumables.show', $id ?? $item_id),
+ default => redirect()->route('home'),
};
}
@@ -1887,6 +1889,7 @@ class Helper
'asset' => $assetId
? redirect()->route('hardware.show', $assetId)
: redirect()->route('hardware.index'),
+ default => redirect()->route('home'),
};
}
@@ -1895,6 +1898,7 @@ class Helper
return match ($other_redirect) {
'audit' => redirect()->route('assets.audit.due'),
'model' => redirect()->route('models.show', $request->model_id),
+ default => redirect()->route('home'),
};
}
diff --git a/app/Http/Controllers/Accessories/AccessoryCheckinController.php b/app/Http/Controllers/Accessories/AccessoryCheckinController.php
index 5a7dc55bcf..4fc22c43c8 100644
--- a/app/Http/Controllers/Accessories/AccessoryCheckinController.php
+++ b/app/Http/Controllers/Accessories/AccessoryCheckinController.php
@@ -67,6 +67,7 @@ class AccessoryCheckinController extends Controller
'App\Models\User' => 'user',
'App\Models\Location' => 'location',
'App\Models\Asset' => 'asset',
+ default => null,
});
$checkin_hours = date('H:i:s');
diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php
index b3c48c167f..9f0402bd0f 100644
--- a/app/Http/Controllers/Assets/AssetCheckinController.php
+++ b/app/Http/Controllers/Assets/AssetCheckinController.php
@@ -112,6 +112,7 @@ class AssetCheckinController extends Controller
'App\Models\User' => 'user',
'App\Models\Location' => 'location',
'App\Models\Asset' => 'asset',
+ default => null,
});
$asset->expected_checkin = null;
diff --git a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php
index f4bc8ce770..f75ca89870 100644
--- a/app/Http/Controllers/Consumables/ConsumableCheckoutController.php
+++ b/app/Http/Controllers/Consumables/ConsumableCheckoutController.php
@@ -104,7 +104,7 @@ class ConsumableCheckoutController extends Controller
}
$admin_user = auth()->user();
- $assigned_to = e($request->input('assigned_to'));
+ $assigned_to = e($request->input('assigned_user'));
// Check if the user exists
if (is_null($user = User::find($assigned_to))) {
@@ -121,7 +121,7 @@ class ConsumableCheckoutController extends Controller
}
// Update the consumable data
- $consumable->assigned_to = e($request->input('assigned_to'));
+ $consumable->assigned_to = e($request->input('assigned_user'));
$consumable->checkout_qty = $quantity;
// Concurrency guard. The unlocked numRemaining() check above is
@@ -146,7 +146,7 @@ class ConsumableCheckoutController extends Controller
$consumable->users()->attach($consumable->id, [
'consumable_id' => $consumable->id,
'created_by' => $admin_user->id,
- 'assigned_to' => e($request->input('assigned_to')),
+ 'assigned_to' => e($request->input('assigned_user')),
'note' => $request->input('note'),
]);
}
diff --git a/app/Http/Controllers/Licenses/LicenseCheckoutController.php b/app/Http/Controllers/Licenses/LicenseCheckoutController.php
index bd24ec584f..a45c877f9b 100644
--- a/app/Http/Controllers/Licenses/LicenseCheckoutController.php
+++ b/app/Http/Controllers/Licenses/LicenseCheckoutController.php
@@ -113,8 +113,8 @@ class LicenseCheckoutController extends Controller
}
if (Setting::getSettings()->full_multiple_companies_support == '1') {
- if ($request->filled('asset_id')) {
- $fmcsTarget = Asset::find($request->input('asset_id'));
+ if ($request->filled('assigned_asset')) {
+ $fmcsTarget = Asset::find($request->input('assigned_asset'));
if ($fmcsTarget && ! $license->canCheckoutTo($fmcsTarget)) {
return redirect()->route('licenses.index')->with('error', trans('general.error_checkout_company_mismatch', [
'item' => trans('general.license').' "'.$license->name.'"',
@@ -122,8 +122,8 @@ class LicenseCheckoutController extends Controller
'target' => trans('general.asset').' "'.$fmcsTarget->display_name.'"',
]));
}
- } elseif ($request->filled('assigned_to')) {
- $fmcsTarget = User::find($request->input('assigned_to'));
+ } elseif ($request->filled('assigned_user')) {
+ $fmcsTarget = User::find($request->input('assigned_user'));
if ($fmcsTarget && ! $license->canCheckoutTo($fmcsTarget)) {
return redirect()->route('licenses.index')->with('error', trans('general.error_checkout_company_mismatch', [
'item' => trans('general.license').' "'.$license->name.'"',
@@ -142,24 +142,20 @@ class LicenseCheckoutController extends Controller
$licenseSeat->created_by = auth()->id();
$licenseSeat->notes = $request->input('notes');
- if ($request->filled('asset_id')) {
+ if ($request->filled('assigned_asset')) {
$checkoutTarget = $this->checkoutToAsset($licenseSeat);
- } elseif ($request->filled('assigned_to')) {
+ } elseif ($request->filled('assigned_user')) {
$checkoutTarget = $this->checkoutToUser($licenseSeat);
}
});
- if ($request->filled('asset_id')) {
- session()->put(['checkout_to_type' => 'asset']);
- $request->request->add(['assigned_asset' => $checkoutTarget->id]);
+ if ($request->filled('assigned_asset')) {
session()->put([
'redirect_option' => $request->input('redirect_option'),
'checkout_to_type' => 'asset',
'sign_in_place' => $request->boolean('sign_in_place'),
]);
- } elseif ($request->filled('assigned_to')) {
- session()->put(['checkout_to_type' => 'user']);
- $request->request->add(['assigned_user' => $checkoutTarget->id]);
+ } elseif ($request->filled('assigned_user')) {
session()->put([
'redirect_option' => $request->input('redirect_option'),
'checkout_to_type' => 'user',
@@ -224,10 +220,10 @@ class LicenseCheckoutController extends Controller
protected function checkoutToAsset($licenseSeat)
{
- if (is_null($target = Asset::find(request('asset_id')))) {
+ if (is_null($target = Asset::find(request('assigned_asset')))) {
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
}
- $licenseSeat->asset_id = request('asset_id');
+ $licenseSeat->asset_id = request('assigned_asset');
// Override asset's assigned user if available
if ($target->checkedOutToUser()) {
@@ -245,10 +241,10 @@ class LicenseCheckoutController extends Controller
protected function checkoutToUser($licenseSeat)
{
// Fetch the target and set the license user
- if (is_null($target = User::find(request('assigned_to')))) {
+ if (is_null($target = User::find(request('assigned_user')))) {
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist'));
}
- $licenseSeat->assigned_to = request('assigned_to');
+ $licenseSeat->assigned_to = request('assigned_user');
if ($licenseSeat->save()) {
event(new CheckoutableCheckedOut($licenseSeat, $target, auth()->user(), request('notes'), [], 1, request()->boolean('sign_in_place')));
diff --git a/app/Http/Requests/LicenseCheckoutRequest.php b/app/Http/Requests/LicenseCheckoutRequest.php
index ad14e00e1c..5b01a94b54 100644
--- a/app/Http/Requests/LicenseCheckoutRequest.php
+++ b/app/Http/Requests/LicenseCheckoutRequest.php
@@ -25,7 +25,7 @@ class LicenseCheckoutRequest extends FormRequest
{
return [
'note' => 'string|nullable',
- 'asset_id' => 'required_without:assigned_to',
+ 'assigned_asset' => 'required_without:assigned_user',
];
}
}
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index bbbd73cdc2..90d372a34e 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -591,6 +591,7 @@ class CheckoutableListener
$checkoutable instanceof Consumable,
$checkoutable instanceof Component => $checkoutable->category,
$checkoutable instanceof LicenseSeat => $checkoutable->license->category,
+ default => null,
};
}
}
diff --git a/app/Livewire/CheckoutTargetPanel.php b/app/Livewire/CheckoutTargetPanel.php
index c3fffa5ca1..6d8bfc6a2e 100644
--- a/app/Livewire/CheckoutTargetPanel.php
+++ b/app/Livewire/CheckoutTargetPanel.php
@@ -85,8 +85,12 @@ class CheckoutTargetPanel extends Component
{
return view('livewire.checkout-target-panel', [
'items' => $this->items(),
- 'noun' => $this->itemNoun(),
- 'targetNoun' => $this->targetNoun(),
+ // $this->type is validated against self::TYPES in mount(),
+ // and $this->targetType is either null or one of TARGET_TYPES
+ // per targetSelected(), so both concatenations always land on
+ // a defined translation key.
+ 'noun' => trans('general.'.$this->type),
+ 'targetNoun' => trans('general.'.($this->targetType ?? 'user')),
]);
}
@@ -144,25 +148,4 @@ class CheckoutTargetPanel extends Component
default => null,
};
}
-
- private function itemNoun(): string
- {
- return match ($this->type) {
- 'assets' => trans('general.assets'),
- 'licenses' => trans('general.licenses'),
- 'accessories' => trans('general.accessories'),
- 'consumables' => trans('general.consumables'),
- 'components' => trans('general.components'),
- };
- }
-
- private function targetNoun(): string
- {
- return match ($this->targetType) {
- 'user' => trans('general.user'),
- 'asset' => trans('general.asset'),
- 'location' => trans('general.location'),
- default => trans('general.user'),
- };
- }
}
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 744a624105..d5c63c8077 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -756,12 +756,6 @@ parameters:
count: 1
path: app/Helpers/Helper.php
- -
- message: '#^Match expression does not handle remaining value\: mixed$#'
- identifier: match.unhandled
- count: 4
- path: app/Helpers/Helper.php
-
-
message: '#^Method App\\Helpers\\Helper\:\:ParseFloat\(\) should return string but returns float\.$#'
identifier: return.type
@@ -906,12 +900,6 @@ parameters:
count: 1
path: app/Http/Controllers/Accessories/AccessoryCheckinController.php
- -
- message: '#^Match expression does not handle remaining values\: string\|null$#'
- identifier: match.unhandled
- count: 1
- path: app/Http/Controllers/Accessories/AccessoryCheckinController.php
-
-
message: '#^PHPDoc tag @param references unknown parameter\: \$request$#'
identifier: parameter.notFound
@@ -2124,12 +2112,6 @@ parameters:
count: 1
path: app/Http/Controllers/Assets/AssetCheckinController.php
- -
- message: '#^Match expression does not handle remaining values\: string\|null$#'
- identifier: match.unhandled
- count: 1
- path: app/Http/Controllers/Assets/AssetCheckinController.php
-
-
message: '#^PHPDoc tag @param references unknown parameter\: \$assetId$#'
identifier: parameter.notFound
@@ -4674,12 +4656,6 @@ parameters:
count: 2
path: app/Listeners/CheckoutableListener.php
- -
- message: '#^Match expression does not handle remaining value\: true$#'
- identifier: match.unhandled
- count: 1
- path: app/Listeners/CheckoutableListener.php
-
-
message: '#^PHPDoc tag @return with type Illuminate\\Support\\Facades\\Notification is incompatible with native type Illuminate\\Notifications\\Notification\.$#'
identifier: return.phpDocType
@@ -4812,12 +4788,6 @@ parameters:
count: 2
path: app/Livewire/CheckoutTargetPanel.php
- -
- message: '#^Match expression does not handle remaining value\: string$#'
- identifier: match.unhandled
- count: 1
- path: app/Livewire/CheckoutTargetPanel.php
-
-
message: '#^Access to an undefined property App\\Livewire\\CustomFieldEditor\:\:\$allowedElementKeys\.$#'
identifier: property.notFound
@@ -10499,9 +10469,3 @@ parameters:
identifier: arguments.count
count: 1
path: routes/web.php
-
- -
- message: '#^Match expression does not handle remaining value\: string$#'
- identifier: match.unhandled
- count: 2
- path: routes/web.php
diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php
index 5b506ea4ae..63c7fce2d3 100644
--- a/resources/views/consumables/checkout.blade.php
+++ b/resources/views/consumables/checkout.blade.php
@@ -34,8 +34,8 @@
<x-input.user-select
:label="trans('general.select_user')"
- name="assigned_to"
- :selected="old('assigned_to', $checkoutRequest?->user_id)"
+ name="assigned_user"
+ :selected="old('assigned_user', $checkoutRequest?->user_id)"
:companyId="$consumable->company_id"
required
/>
diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.php
index 353130a448..eb633c4e7d 100755
--- a/resources/views/licenses/checkout.blade.php
+++ b/resources/views/licenses/checkout.blade.php
@@ -45,12 +45,12 @@
@include ('partials.forms.checkout-selector', ['user_select' => 'true', 'asset_select' => 'true', 'location_select' => 'false'])
<x-input.user-select
:label="trans('general.user')"
- name="assigned_to"
- :selected="old('assigned_to', $checkoutRequest?->user_id)"
+ name="assigned_user"
+ :selected="old('assigned_user', $checkoutRequest?->user_id)"
:companyId="$license->company_id"
:style="(session('checkout_to_type') ?: 'user') == 'user' ? null : 'display: none;'"
/>
- @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'asset_id', 'company_id' => $license->company_id, 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])
+ @include ('partials.forms.edit.asset-select', ['translated_name' => trans('general.select_asset'), 'fieldname' => 'assigned_asset', 'company_id' => $license->company_id, 'style' => session('checkout_to_type') == 'asset' ? '' : 'display: none;'])
<x-form.row
:label="trans('general.checkout_note')"
diff --git a/routes/web.php b/routes/web.php
index ac3e899b71..4dc49ea118 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -740,10 +740,13 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {
Route::get('/{reportTemplate}', [ReportTemplatesController::class, 'show'])
->name('report-templates.show')
->breadcrumbs(function (Trail $trail, ReportTemplate $reportTemplate) {
+ // 'asset' folds into the default since it maps to the
+ // same breadcrumb parent. Component / consumable have
+ // their own custom-report parents.
$parent = match ($reportTemplate->type) {
- 'asset' => 'reports/custom',
'component' => 'reports.custom.component',
'consumable' => 'reports.custom.consumable',
+ default => 'reports/custom',
};
return $trail->parent($parent)
@@ -753,10 +756,13 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {
Route::get('/{reportTemplate}/edit', [ReportTemplatesController::class, 'edit'])
->name('report-templates.edit')
->breadcrumbs(function (Trail $trail, ReportTemplate $reportTemplate) {
+ // 'asset' folds into the default since it maps to the
+ // same breadcrumb parent. Component / consumable have
+ // their own custom-report parents.
$parent = match ($reportTemplate->type) {
- 'asset' => 'reports/custom',
'component' => 'reports.custom.component',
'consumable' => 'reports.custom.consumable',
+ default => 'reports/custom',
};
return $trail->parent($parent)
diff --git a/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php b/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php
index 50dcbbccb9..1ca691e8ae 100644
--- a/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php
+++ b/tests/Feature/Checkouts/General/SettingAlertOnResponseTest.php
@@ -198,7 +198,7 @@ class SettingAlertOnResponseTest extends TestCase
$this->actingAs($this->actor)
->post("/licenses/{$license->id}/checkout/", [
'checkout_to_type' => 'user',
- 'assigned_to' => $this->assignedUser->id,
+ 'assigned_user' => $this->assignedUser->id,
]);
}
@@ -207,7 +207,7 @@ class SettingAlertOnResponseTest extends TestCase
$this->actingAs($this->actor)
->post(route('consumables.checkout.store', $consumable), [
'checkout_to_type' => 'user',
- 'assigned_to' => $this->assignedUser->id,
+ 'assigned_user' => $this->assignedUser->id,
'checkout_qty' => 1,
]);
}
diff --git a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php
index 03cc76b95f..5319638440 100644
--- a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php
+++ b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php
@@ -30,7 +30,7 @@ class ConsumableCheckoutTest extends TestCase
{
$this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', Consumable::factory()->create()), [
- // missing assigned_to
+ // missing assigned_user
])
->assertSessionHas('error');
}
@@ -39,7 +39,7 @@ class ConsumableCheckoutTest extends TestCase
{
$this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', Consumable::factory()->withoutItemsRemaining()->create()), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
])
->assertSessionHas('error');
}
@@ -51,7 +51,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
]);
$this->assertTrue($user->consumables->contains($consumable));
@@ -67,7 +67,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutConsumables()->create())
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
]);
Mail::assertSent(CheckoutConsumableMail::class, function ($mail) use ($user) {
@@ -83,7 +83,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs($actor)
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
'note' => 'oh hi there',
]);
@@ -109,7 +109,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('consumables.index'))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
'redirect_option' => 'index',
'assigned_qty' => 1,
])
@@ -124,7 +124,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('consumables.index'))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
'redirect_option' => 'item',
'assigned_qty' => 1,
])
@@ -140,7 +140,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('components.index'))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
'redirect_option' => 'target',
'assigned_qty' => 1,
])
@@ -158,7 +158,7 @@ class ConsumableCheckoutTest extends TestCase
$this->actingAs($admin)
->from(route('components.index'))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
'redirect_option' => 'target',
'checkout_qty' => 2,
]);
@@ -182,7 +182,7 @@ class ConsumableCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->from(route('consumables.checkout.show', $consumable))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'checkout_qty' => 2,
'sign_in_place' => 1,
@@ -212,7 +212,7 @@ class ConsumableCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->from(route('consumables.checkout.show', $consumable))
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'checkout_qty' => 2,
'sign_in_place' => 1,
@@ -241,7 +241,7 @@ class ConsumableCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'checkout_qty' => 1,
'sign_in_place' => 1,
diff --git a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php
index ba81e6e30e..439e68e4c8 100644
--- a/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php
+++ b/tests/Feature/Checkouts/Ui/LicenseCheckoutTest.php
@@ -27,8 +27,8 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs($admin)
->post(route('licenses.checkout', $licenseSeat->license), [
'checkout_to_type' => 'asset',
- 'assigned_to' => null,
- 'asset_id' => $asset->id,
+ 'assigned_user' => null,
+ 'assigned_asset' => $asset->id,
'notes' => 'oh hi there',
]);
@@ -51,8 +51,8 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs($admin)
->post(route('licenses.checkout', $licenseSeat->license), [
'checkout_to_type' => 'user',
- 'assigned_to' => $admin->id,
- 'asset_id' => null,
+ 'assigned_user' => $admin->id,
+ 'assigned_asset' => null,
'notes' => 'oh hi there',
]);
@@ -74,7 +74,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $license))
->post(route('licenses.checkout', $license), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
'redirect_option' => 'index',
'assigned_qty' => 1,
])
@@ -89,7 +89,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $license))
->post(route('licenses.checkout', $license), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
'redirect_option' => 'item',
])
->assertStatus(302)
@@ -104,7 +104,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $license))
->post(route('licenses.checkout', $license), [
- 'assigned_to' => $user->id,
+ 'assigned_user' => $user->id,
'redirect_option' => 'target',
])
->assertStatus(302)
@@ -119,7 +119,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $license))
->post(route('licenses.checkout', $license), [
- 'asset_id' => $asset->id,
+ 'assigned_asset' => $asset->id,
'redirect_option' => 'target',
])
->assertStatus(302)
@@ -134,7 +134,7 @@ class LicenseCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $seat->license))
->post(route('licenses.checkout', $seat->license), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'sign_in_place' => 1,
]);
@@ -161,7 +161,7 @@ class LicenseCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->from(route('licenses.checkout', $seat->license))
->post(route('licenses.checkout', $seat->license), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'sign_in_place' => 1,
]);
@@ -189,7 +189,7 @@ class LicenseCheckoutTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->post(route('licenses.checkout', $seat->license), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'sign_in_place' => 1,
]);
diff --git a/tests/Feature/Licenses/Ui/LicenseCheckoutTest.php b/tests/Feature/Licenses/Ui/LicenseCheckoutTest.php
index 47956b7fc5..694741a7c6 100644
--- a/tests/Feature/Licenses/Ui/LicenseCheckoutTest.php
+++ b/tests/Feature/Licenses/Ui/LicenseCheckoutTest.php
@@ -20,7 +20,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->create())
->post(route('licenses.checkout.save', $license->id), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
])
->assertForbidden();
}
@@ -36,7 +36,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutLicenses()->create())
->post(route('licenses.checkout.save', $license->id), [
- 'assigned_to' => $target->id,
+ 'assigned_user' => $target->id,
])
->assertRedirect()
->assertSessionHas('success');
@@ -56,7 +56,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutLicenses()->create())
->post(route('licenses.checkout.save', $license->id), [
- 'asset_id' => $asset->id,
+ 'assigned_asset' => $asset->id,
])
->assertRedirect()
->assertSessionHas('success');
@@ -76,7 +76,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutLicenses()->create())
->post(route('licenses.checkout.save', ['licenseId' => $license->id, 'seatId' => $seats[1]->id]), [
- 'assigned_to' => $target->id,
+ 'assigned_user' => $target->id,
])
->assertRedirect()
->assertSessionHas('success');
@@ -94,7 +94,7 @@ class LicenseCheckoutTest extends TestCase
$this->actingAs(User::factory()->checkoutLicenses()->create())
->post(route('licenses.checkout.save', $license->id), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
])
->assertRedirect()
->assertSessionHas('error');
@@ -111,11 +111,11 @@ class LicenseCheckoutTest extends TestCase
$user2 = User::factory()->create();
$this->actingAs($actor)
- ->post(route('licenses.checkout.save', $license->id), ['assigned_to' => $user1->id])
+ ->post(route('licenses.checkout.save', $license->id), ['assigned_user' => $user1->id])
->assertSessionHas('success');
$this->actingAs($actor)
- ->post(route('licenses.checkout.save', $license->id), ['assigned_to' => $user2->id])
+ ->post(route('licenses.checkout.save', $license->id), ['assigned_user' => $user2->id])
->assertSessionHas('success');
$assignedTo = $license->licenseseats()->pluck('assigned_to');
@@ -138,13 +138,13 @@ class LicenseCheckoutTest extends TestCase
foreach ([User::factory()->create(), User::factory()->create()] as $user) {
$this->actingAs($actor)
- ->post(route('licenses.checkout.save', $license->id), ['assigned_to' => $user->id])
+ ->post(route('licenses.checkout.save', $license->id), ['assigned_user' => $user->id])
->assertSessionHas('success');
}
$this->actingAs($actor)
->post(route('licenses.checkout.save', $license->id), [
- 'assigned_to' => User::factory()->create()->id,
+ 'assigned_user' => User::factory()->create()->id,
])
->assertRedirect()
->assertSessionHas('error');
diff --git a/tests/Feature/Notifications/Email/SignInPlaceCheckoutEmailSuppressionTest.php b/tests/Feature/Notifications/Email/SignInPlaceCheckoutEmailSuppressionTest.php
index 63876c2f82..3ce7b0c023 100644
--- a/tests/Feature/Notifications/Email/SignInPlaceCheckoutEmailSuppressionTest.php
+++ b/tests/Feature/Notifications/Email/SignInPlaceCheckoutEmailSuppressionTest.php
@@ -69,7 +69,7 @@ class SignInPlaceCheckoutEmailSuppressionTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->post(route('consumables.checkout.store', $consumable), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'checkout_qty' => 2,
'sign_in_place' => 1,
@@ -95,7 +95,7 @@ class SignInPlaceCheckoutEmailSuppressionTest extends TestCase
$response = $this->actingAs(User::factory()->admin()->create())
->post(route('licenses.checkout', $seat->license), [
- 'assigned_to' => $targetUser->id,
+ 'assigned_user' => $targetUser->id,
'redirect_option' => 'index',
'sign_in_place' => 1,
]);