Default the availability admin page to the week view too
CI / Tests (PHP 8.2) (pull_request) Successful in 38s
CI / Tests (PHP 8.1) (pull_request) Successful in 48s
CI / No Debug Code (pull_request) Successful in 3s
CI / Coding Standards (pull_request) Successful in 2m49s
CI / PHPStan (pull_request) Successful in 2m53s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m38s
CI / Build Plugin Zip (pull_request) Skipped

Follow-up demo feedback: the My Availability page now opens in its weekly
calendar (usc_view=list opts back into the table, which keeps the bulk-delete
form), matching the new lessons defaults.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-22 11:09:23 -03:00
co-authored by Claude Fable 5
parent 5808defd1a
commit 266f572884
4 changed files with 22 additions and 6 deletions
@@ -99,8 +99,24 @@ class AvailabilityControllerTest extends TestCase
$this->render();
}
public function testDefaultsToWeekView(): void
{
$slot = new AvailabilitySlot(instructorId: 3, startDt: '2026-07-08 09:00:00', endDt: '2026-07-08 10:00:00', id: 5);
$this->repository->shouldReceive('findByInstructor')->once()->with(3)->andReturn([$slot]);
$html = $this->render();
// Week of Monday 2026-07-06 (start_of_week = 1, today = 2026-07-06).
self::assertStringContainsString('Week of', $html);
// The list table (with its bulk-delete form) is not rendered by default.
self::assertStringNotContainsString('id="usc-bulk-delete-form"', $html);
}
public function testListViewRendersBulkCheckboxesOnlyForUnbookedSlots(): void
{
$_GET['usc_view'] = 'list';
$unbooked = new AvailabilitySlot(instructorId: 3, startDt: '2026-07-08 09:00:00', endDt: '2026-07-08 10:00:00', id: 5);
$booked = new AvailabilitySlot(instructorId: 3, startDt: '2026-07-08 10:00:00', endDt: '2026-07-08 11:00:00', isBooked: true, id: 6);