A free open source IT asset/license management system
More bulk action tests
snipede627e3c01fe
diff --git a/tests/Feature/Accessories/AccessoryArchiveValidationTest.php b/tests/Feature/Accessories/AccessoryArchiveValidationTest.phpindex 6a840b1af8..35504a7eae 100644--- a/tests/Feature/Accessories/AccessoryArchiveValidationTest.php+++ b/tests/Feature/Accessories/AccessoryArchiveValidationTest.php@@ -51,7 +51,7 @@ class AccessoryArchiveValidationTest extends TestCase$this->assertFalse($accessory->save());$this->assertSame(- trans('admin/accessories/message.archived_blocked_by_checkouts'),+ trans('general.archived_blocked_by_checkouts', ['item_type' => trans('general.accessory')]),$accessory->getErrors()->get('archived')[0],);}diff --git a/tests/Feature/Accessories/Ui/BulkCheckinAccessoriesTest.php b/tests/Feature/Accessories/Ui/BulkCheckinAccessoriesTest.phpnew file mode 100644index 0000000000..462e830418--- /dev/null+++ b/tests/Feature/Accessories/Ui/BulkCheckinAccessoriesTest.php@@ -0,0 +1,188 @@+<?php++namespace Tests\Feature\Accessories\Ui;++use App\Events\CheckoutableCheckedIn;+use App\Models\Accessory;+use App\Models\AccessoryCheckout;+use App\Models\Actionlog;+use App\Models\Company;+use App\Models\User;+use Illuminate\Support\Facades\Event;+use Tests\TestCase;++class BulkCheckinAccessoriesTest extends TestCase+{+ public function test_requires_checkin_permission_on_show(): void+ {+ $accessory = Accessory::factory()->create();+ $checkout = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->viewAccessories()->create())+ ->post(route('accessories.bulkcheckin.show'), ['ids' => [$checkout->id]])+ ->assertForbidden();++ $this->assertDatabaseHas('accessories_checkout', ['id' => $checkout->id]);+ }++ public function test_requires_checkin_permission_on_store(): void+ {+ $accessory = Accessory::factory()->create();+ $checkout = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->viewAccessories()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$checkout->id]])+ ->assertForbidden();++ $this->assertDatabaseHas('accessories_checkout', ['id' => $checkout->id]);+ }++ public function test_show_renders_interstitial_with_selected_rows(): void+ {+ $accessory = Accessory::factory()->create();+ $checkoutA = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();+ $checkoutB = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.show'), ['ids' => [$checkoutA->id, $checkoutB->id]])+ ->assertOk()+ ->assertViewIs('accessories.bulk-checkin')+ ->assertViewHas('ids', [$checkoutA->id, $checkoutB->id]);++ $this->assertDatabaseHas('accessories_checkout', ['id' => $checkoutA->id]);+ $this->assertDatabaseHas('accessories_checkout', ['id' => $checkoutB->id]);+ }++ public function test_show_warns_when_no_rows_selected(): void+ {+ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.show'), ['ids' => []])+ ->assertRedirect()+ ->assertSessionHas('warning');+ }++ public function test_store_removes_checkout_rows_and_fires_event(): void+ {+ Event::fake([CheckoutableCheckedIn::class]);++ $accessory = Accessory::factory()->create();+ $checkoutA = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();+ $checkoutB = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$checkoutA->id, $checkoutB->id]])+ ->assertRedirect()+ ->assertSessionHas('success');++ $this->assertDatabaseMissing('accessories_checkout', ['id' => $checkoutA->id]);+ $this->assertDatabaseMissing('accessories_checkout', ['id' => $checkoutB->id]);++ Event::assertDispatchedTimes(CheckoutableCheckedIn::class, 2);+ }++ public function test_store_warns_when_no_rows_selected(): void+ {+ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => []])+ ->assertRedirect()+ ->assertSessionHas('warning');+ }++ public function test_success_message_reports_count(): void+ {+ $accessory = Accessory::factory()->create();+ $a = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();+ $b = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();+ $c = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$a->id, $b->id, $c->id]])+ ->assertRedirect()+ ->assertSessionHas('success', trans_choice(+ 'admin/accessories/message.bulk.checkin_selected.success',+ 3,+ ['count' => 3],+ ));+ }++ public function test_success_message_handles_single_row(): void+ {+ $accessory = Accessory::factory()->create();+ $checkout = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$checkout->id]])+ ->assertRedirect()+ ->assertSessionHas('success', trans_choice(+ 'admin/accessories/message.bulk.checkin_selected.success',+ 1,+ ['count' => 1],+ ));+ }++ public function test_shared_note_lands_on_every_action_log(): void+ {+ // Regression test: the whole reason for the interstitial is to+ // capture a shared note. The posted `note` must thread into+ // every per-row CheckoutableCheckedIn event so each resulting+ // action_log row carries it.+ $accessory = Accessory::factory()->create();+ $a = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();+ $b = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), [+ 'ids' => [$a->id, $b->id],+ 'note' => 'End-of-lease returns, batch 2026-Q4',+ ])+ ->assertRedirect();++ $logs = Actionlog::where('item_type', Accessory::class)+ ->where('item_id', $accessory->id)+ ->where('action_type', 'checkin from')+ ->get();++ $this->assertCount(2, $logs);+ foreach ($logs as $log) {+ $this->assertSame('End-of-lease returns, batch 2026-Q4', $log->note);+ }+ }++ public function test_unknown_checkout_ids_are_silently_skipped(): void+ {+ // Stale rows posted from a dropdown-swap race just get skipped+ // so the real selections still check in cleanly.+ Event::fake([CheckoutableCheckedIn::class]);++ $accessory = Accessory::factory()->create();+ $checkout = AccessoryCheckout::factory()->for($accessory, 'accessory')->create();++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$checkout->id, 999999]])+ ->assertRedirect()+ ->assertSessionHas('success');++ $this->assertDatabaseMissing('accessories_checkout', ['id' => $checkout->id]);+ Event::assertDispatchedTimes(CheckoutableCheckedIn::class, 1);+ }++ public function test_cross_company_checkout_rows_are_filtered_under_fmcs(): void+ {+ // Regression test: AccessoryCheckout has no CompanyableTrait,+ // so defense in depth lives on the controller's accessory_id+ // subquery against Accessory's CompanyableScope. A hand-crafted+ // POST referencing a cross-tenant checkout must not succeed.+ $this->settings->enableMultipleFullCompanySupport();++ [$companyA, $companyB] = Company::factory()->count(2)->create();+ $actor = $companyA->users()->save(User::factory()->checkinAccessories()->viewAccessories()->make());+ $foreignAccessory = Accessory::factory()->for($companyB)->create();+ $foreignCheckout = AccessoryCheckout::factory()->for($foreignAccessory, 'accessory')->create();++ $this->actingAs($actor)+ ->post(route('accessories.bulkcheckin.store'), ['ids' => [$foreignCheckout->id]])+ ->assertRedirect();++ $this->assertDatabaseHas('accessories_checkout', ['id' => $foreignCheckout->id]);+ }+}diff --git a/tests/Feature/Components/ComponentArchiveValidationTest.php b/tests/Feature/Components/ComponentArchiveValidationTest.phpindex eba9aca8ba..88ccf084ba 100644--- a/tests/Feature/Components/ComponentArchiveValidationTest.php+++ b/tests/Feature/Components/ComponentArchiveValidationTest.php@@ -64,7 +64,7 @@ class ComponentArchiveValidationTest extends TestCase$this->assertFalse($component->save());$this->assertSame(- trans('admin/components/message.archived_blocked_by_checkouts'),+ trans('general.archived_blocked_by_checkouts', ['item_type' => trans('general.component')]),$component->getErrors()->get('archived')[0],);}diff --git a/tests/Feature/Components/Ui/ArchivedComponentCheckoutGuardTest.php b/tests/Feature/Components/Ui/ArchivedComponentCheckoutGuardTest.phpindex d8cd8473fa..acffc021de 100644--- a/tests/Feature/Components/Ui/ArchivedComponentCheckoutGuardTest.php+++ b/tests/Feature/Components/Ui/ArchivedComponentCheckoutGuardTest.php@@ -16,7 +16,7 @@ class ArchivedComponentCheckoutGuardTest extends TestCase$this->actingAs(User::factory()->superuser()->create())->get(route('components.checkout.show', ['componentID' => $component->id]))->assertRedirect(route('components.index'))- ->assertSessionHas('error', trans('admin/components/message.checkout.archived'));+ ->assertSessionHas('error', trans('general.cannot_checkout_archived', ['item_type' => trans('general.component')]));}public function test_checkout_store_blocks_archived_component(): void@@ -30,7 +30,7 @@ class ArchivedComponentCheckoutGuardTest extends TestCase'assigned_qty' => 1,])->assertRedirect(route('components.index'))- ->assertSessionHas('error', trans('admin/components/message.checkout.archived'));+ ->assertSessionHas('error', trans('general.cannot_checkout_archived', ['item_type' => trans('general.component')]));// No pivot row created.$this->assertSame(0, $component->assets()->count());diff --git a/tests/Feature/Components/Ui/BulkCheckinComponentsTest.php b/tests/Feature/Components/Ui/BulkCheckinComponentsTest.phpindex 4bbb5b9503..8c9192f474 100644--- a/tests/Feature/Components/Ui/BulkCheckinComponentsTest.php+++ b/tests/Feature/Components/Ui/BulkCheckinComponentsTest.php@@ -3,6 +3,7 @@namespace Tests\Feature\Components\Ui;use App\Events\CheckoutableCheckedIn;+use App\Models\Actionlog;use App\Models\Asset;use App\Models\Component;use App\Models\ComponentAssignment;@@ -26,20 +27,57 @@ class BulkCheckinComponentsTest extends TestCase->value('id');}- public function test_requires_checkin_permission(): void+ public function test_requires_checkin_permission_on_show(): void{$component = Component::factory()->create(['qty' => 5]);$asset = Asset::factory()->create();$pivotId = $this->attachCheckout($component, $asset);$this->actingAs(User::factory()->viewComponents()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivotId]])+ ->post(route('components.bulkcheckin.show'), ['ids' => [$pivotId]])->assertForbidden();$this->assertDatabaseHas('components_assets', ['id' => $pivotId]);}- public function test_removes_pivot_rows_and_fires_event(): void+ public function test_requires_checkin_permission_on_store(): void+ {+ $component = Component::factory()->create(['qty' => 5]);+ $asset = Asset::factory()->create();+ $pivotId = $this->attachCheckout($component, $asset);++ $this->actingAs(User::factory()->viewComponents()->create())+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivotId]])+ ->assertForbidden();++ $this->assertDatabaseHas('components_assets', ['id' => $pivotId]);+ }++ public function test_show_renders_interstitial_with_selected_rows(): void+ {+ $component = Component::factory()->create(['qty' => 10]);+ $pivotA = $this->attachCheckout($component, Asset::factory()->create(), 2);+ $pivotB = $this->attachCheckout($component, Asset::factory()->create(), 3);++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('components.bulkcheckin.show'), ['ids' => [$pivotA, $pivotB]])+ ->assertOk()+ ->assertViewIs('components.bulk-checkin')+ ->assertViewHas('ids', [$pivotA, $pivotB]);++ $this->assertDatabaseHas('components_assets', ['id' => $pivotA]);+ $this->assertDatabaseHas('components_assets', ['id' => $pivotB]);+ }++ public function test_show_warns_when_no_rows_selected(): void+ {+ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('components.bulkcheckin.show'), ['ids' => []])+ ->assertRedirect()+ ->assertSessionHas('warning');+ }++ public function test_store_removes_pivot_rows_and_fires_event(): void{Event::fake([CheckoutableCheckedIn::class]);@@ -51,7 +89,7 @@ class BulkCheckinComponentsTest extends TestCase$pivotB = $this->attachCheckout($component, $assetB, 3);$this->actingAs(User::factory()->superuser()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivotA, $pivotB]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivotA, $pivotB]])->assertRedirect()->assertSessionHas('success');@@ -65,10 +103,10 @@ class BulkCheckinComponentsTest extends TestCaseEvent::assertDispatchedTimes(CheckoutableCheckedIn::class, 2);}- public function test_warns_when_no_rows_selected(): void+ public function test_store_warns_when_no_rows_selected(): void{$this->actingAs(User::factory()->superuser()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => []])+ ->post(route('components.bulkcheckin.store'), ['ids' => []])->assertRedirect()->assertSessionHas('warning');}@@ -87,7 +125,7 @@ class BulkCheckinComponentsTest extends TestCase$pivotC = $this->attachCheckout($component, Asset::factory()->create(), 7);$this->actingAs(User::factory()->superuser()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivotA, $pivotB, $pivotC]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivotA, $pivotB, $pivotC]])->assertRedirect()->assertSessionHas('success', trans_choice('admin/components/message.bulk.checkin_selected.success',@@ -104,7 +142,7 @@ class BulkCheckinComponentsTest extends TestCase$pivot = $this->attachCheckout($component, Asset::factory()->create(), 1);$this->actingAs(User::factory()->superuser()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivot]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivot]])->assertRedirect()->assertSessionHas('success', trans_choice('admin/components/message.bulk.checkin_selected.success',@@ -113,6 +151,34 @@ class BulkCheckinComponentsTest extends TestCase));}+ public function test_shared_note_lands_on_every_action_log(): void+ {+ // Regression test: the whole reason for the interstitial is to+ // capture a shared note. The posted `note` must thread into+ // every per-row CheckoutableCheckedIn event so each resulting+ // action_log row carries it.+ $component = Component::factory()->create(['qty' => 10]);+ $pivotA = $this->attachCheckout($component, Asset::factory()->create(), 1);+ $pivotB = $this->attachCheckout($component, Asset::factory()->create(), 1);++ $this->actingAs(User::factory()->superuser()->create())+ ->post(route('components.bulkcheckin.store'), [+ 'ids' => [$pivotA, $pivotB],+ 'note' => 'End-of-lease returns, batch 2026-Q4',+ ])+ ->assertRedirect();++ $logs = Actionlog::where('item_type', Component::class)+ ->where('item_id', $component->id)+ ->where('action_type', 'checkin from')+ ->get();++ $this->assertCount(2, $logs);+ foreach ($logs as $log) {+ $this->assertSame('End-of-lease returns, batch 2026-Q4', $log->note);+ }+ }+public function test_unknown_pivot_ids_are_silently_skipped(): void{// Mirrors the LicenseCheckinController flow: stale pivot ids@@ -125,7 +191,7 @@ class BulkCheckinComponentsTest extends TestCase$pivotId = $this->attachCheckout($component, $asset);$this->actingAs(User::factory()->superuser()->create())- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivotId, 999999]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivotId, 999999]])->assertRedirect()->assertSessionHas('success');diff --git a/tests/Feature/Components/Ui/BulkComponentsFmcsScopingTest.php b/tests/Feature/Components/Ui/BulkComponentsFmcsScopingTest.phpindex 80e9212eec..08a8c91be7 100644--- a/tests/Feature/Components/Ui/BulkComponentsFmcsScopingTest.php+++ b/tests/Feature/Components/Ui/BulkComponentsFmcsScopingTest.php@@ -114,7 +114,7 @@ class BulkComponentsFmcsScopingTest extends TestCase$pivot = $this->pivotId($foreignComponent, Asset::factory()->create());$this->actingAs($actor)- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivot]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivot]])->assertRedirect();$this->assertDatabaseHas('components_assets', ['id' => $pivot]);@@ -186,7 +186,7 @@ class BulkComponentsFmcsScopingTest extends TestCase$pivot = $this->pivotId($floater, Asset::factory()->create());$this->actingAs($actor)- ->post(route('components.bulkcheckin.selected'), ['ids' => [$pivot]])+ ->post(route('components.bulkcheckin.store'), ['ids' => [$pivot]])->assertRedirect()->assertSessionHas('success');diff --git a/tests/Feature/Licenses/Ui/BulkCheckinSelectedLicenseSeatsTest.php b/tests/Feature/Licenses/Ui/BulkCheckinSelectedLicenseSeatsTest.phpindex bf995c4900..a817470628 100644--- a/tests/Feature/Licenses/Ui/BulkCheckinSelectedLicenseSeatsTest.php+++ b/tests/Feature/Licenses/Ui/BulkCheckinSelectedLicenseSeatsTest.php@@ -3,6 +3,7 @@namespace Tests\Feature\Licenses\Ui;use App\Events\CheckoutableCheckedIn;+use App\Models\Actionlog;use App\Models\Asset;use App\Models\Company;use App\Models\License;@@ -19,10 +20,45 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToUser()->create();$this->actingAs(User::factory()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]])->assertForbidden();}+ public function test_requires_permission_on_show()+ {+ $seat = LicenseSeat::factory()->assignedToUser()->create();++ $this->actingAs(User::factory()->create())+ ->post(route('licenses.bulkcheckin.show'), ['ids' => [$seat->id]])+ ->assertForbidden();+ }++ public function test_show_renders_interstitial_with_selected_seats()+ {+ $license = License::factory()->create(['seats' => 3]);+ $seat1 = LicenseSeat::factory()->assignedToUser()->create(['license_id' => $license->id]);+ $seat2 = LicenseSeat::factory()->assignedToUser()->create(['license_id' => $license->id]);++ $this->actingAs(User::factory()->checkinLicenses()->create())+ ->post(route('licenses.bulkcheckin.show'), ['ids' => [$seat1->id, $seat2->id]])+ ->assertOk()+ ->assertViewIs('licenses.bulk-checkin')+ ->assertViewHas('ids', [$seat1->id, $seat2->id]);++ // Nothing is actually checked in until the interstitial posts+ // to .store.+ $this->assertNotNull($seat1->fresh()->assigned_to);+ $this->assertNotNull($seat2->fresh()->assigned_to);+ }++ public function test_show_warns_when_no_rows_selected()+ {+ $this->actingAs(User::factory()->checkinLicenses()->create())+ ->post(route('licenses.bulkcheckin.show'), ['ids' => []])+ ->assertRedirect()+ ->assertSessionHas('warning', trans('admin/licenses/general.bulk.checkin_selected.no_seats_selected'));+ }+public function test_can_bulk_checkin_seats_assigned_to_users(){Event::fake([CheckoutableCheckedIn::class]);@@ -34,7 +70,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat2 = LicenseSeat::factory()->assignedToUser($user2)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat1->id, $seat2->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat1->id, $seat2->id]])->assertRedirect()->assertSessionHas('success');@@ -53,7 +89,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToAsset($asset)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]])->assertRedirect()->assertSessionHas('success');@@ -65,7 +101,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermipublic function test_empty_ids_returns_warning(){$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => []])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => []])->assertRedirect()->assertSessionHas('warning', trans('admin/licenses/general.bulk.checkin_selected.no_seats_selected'));}@@ -73,7 +109,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermipublic function test_missing_ids_returns_warning(){$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), [])+ ->post(route('licenses.bulkcheckin.store'), [])->assertRedirect()->assertSessionHas('warning', trans('admin/licenses/general.bulk.checkin_selected.no_seats_selected'));}@@ -86,9 +122,9 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$unassignedSeat = LicenseSeat::factory()->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$unassignedSeat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$unassignedSeat->id]])->assertRedirect()- ->assertSessionHas('success');+ ->assertSessionHas('warning');$this->assertNull($unassignedSeat->fresh()->assigned_to);$this->assertNull($unassignedSeat->fresh()->asset_id);@@ -103,7 +139,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToUser($user)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]])->assertRedirect()->assertSessionHas('success');@@ -117,7 +153,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToUser($user)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]])->assertRedirect()->assertSessionHas('success');@@ -135,7 +171,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat2 = LicenseSeat::factory()->assignedToUser($user2)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat1->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat1->id]])->assertRedirect();$this->assertNull($seat1->fresh()->assigned_to);@@ -153,7 +189,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat2 = LicenseSeat::factory()->assignedToUser($user2)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat1->id, $seat2->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat1->id, $seat2->id]])->assertSessionHas('success', trans_choice('admin/licenses/general.bulk.checkin_selected.success', 2, ['count' => 2]));}@@ -166,7 +202,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToUser($targetUser)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]]);+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]]);Event::assertDispatched(CheckoutableCheckedIn::class, function ($event) use ($targetUser) {return $event->checkedOutTo->id === $targetUser->id;@@ -182,13 +218,41 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$seat = LicenseSeat::factory()->assignedToAsset($targetAsset)->create(['license_id' => $license->id]);$this->actingAs(User::factory()->checkinLicenses()->create())- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]]);+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]]);Event::assertDispatched(CheckoutableCheckedIn::class, function ($event) use ($targetAsset) {return $event->checkedOutTo->id === $targetAsset->id;});}+ public function test_shared_note_lands_on_every_action_log()+ {+ // Regression test: the whole reason for the interstitial is to+ // capture a shared note. The posted `note` must thread into+ // every per-row CheckoutableCheckedIn event so each resulting+ // action_log row carries it.+ $license = License::factory()->create(['seats' => 3]);+ $seat1 = LicenseSeat::factory()->assignedToUser()->create(['license_id' => $license->id]);+ $seat2 = LicenseSeat::factory()->assignedToUser()->create(['license_id' => $license->id]);++ $this->actingAs(User::factory()->checkinLicenses()->create())+ ->post(route('licenses.bulkcheckin.store'), [+ 'ids' => [$seat1->id, $seat2->id],+ 'note' => 'End-of-lease returns, batch 2026-Q4',+ ])+ ->assertRedirect();++ $logs = Actionlog::where('item_type', License::class)+ ->where('item_id', $license->id)+ ->where('action_type', 'checkin from')+ ->get();++ $this->assertCount(2, $logs);+ foreach ($logs as $log) {+ $this->assertSame('End-of-lease returns, batch 2026-Q4', $log->note);+ }+ }+public function test_fmcs_prevents_checkin_of_seat_from_other_company(){Event::fake([CheckoutableCheckedIn::class]);@@ -203,7 +267,7 @@ class BulkCheckinSelectedLicenseSeatsTest extends TestCase implements TestsPermi$this->settings->enableMultipleFullCompanySupport();$this->actingAs($actor)- ->post(route('licenses.bulkcheckin.selected'), ['ids' => [$seat->id]])+ ->post(route('licenses.bulkcheckin.store'), ['ids' => [$seat->id]])->assertRedirect();$this->assertNotNull($seat->fresh()->assigned_to);