A free open source IT asset/license management system
Add failing test
Marcus Moore6d87ee56f580
diff --git a/tests/Feature/LicenseSeats/Api/LicenseSeatsIndexTest.php b/tests/Feature/LicenseSeats/Api/LicenseSeatsIndexTest.phpnew file mode 100644index 0000000000..21c1794645--- /dev/null+++ b/tests/Feature/LicenseSeats/Api/LicenseSeatsIndexTest.php@@ -0,0 +1,26 @@+<?php++namespace Tests\Feature\LicenseSeats\Api;++use App\Models\License;+use App\Models\LicenseSeat;+use App\Models\User;+use Tests\TestCase;++class LicenseSeatsIndexTest extends TestCase+{+ public function test_seats_with_identical_updated_at_are_ordered_by_id()+ {+ $license = License::factory()->create(['seats' => 5]);++ LicenseSeat::where('license_id', $license->id)->update(['updated_at' => '2024-01-01 00:00:00']);++ $expectedIds = $license->licenseseats()->pluck('id')->sortDesc()->values()->all();++ $response = $this->actingAsForApi(User::factory()->superuser()->create())+ ->getJson(route('api.licenses.seats.index', $license))+ ->assertOk();++ $this->assertSame($expectedIds, collect($response->json('rows'))->pluck('id')->all());+ }+}