'2026-06-10 09:00:00', 'label' => 'future-a'], ['start_dt' => '2026-06-01 09:00:00', 'label' => 'past-a'], ['start_dt' => '2026-06-20 09:00:00', 'label' => 'future-b'], ['start_dt' => '2026-05-15 09:00:00', 'label' => 'past-b'], ]; $result = StudentSchedule::partition($rows, '2026-06-08 12:00:00'); self::assertSame(['future-a', 'future-b'], array_column($result['upcoming'], 'label')); self::assertSame(['past-a', 'past-b'], array_column($result['past'], 'label')); } public function testUpcomingSortedAscendingAndPastDescending(): void { $rows = [ ['start_dt' => '2026-06-20 09:00:00'], ['start_dt' => '2026-06-10 09:00:00'], ['start_dt' => '2026-05-01 09:00:00'], ['start_dt' => '2026-05-30 09:00:00'], ]; $result = StudentSchedule::partition($rows, '2026-06-08 00:00:00'); self::assertSame( ['2026-06-10 09:00:00', '2026-06-20 09:00:00'], array_column($result['upcoming'], 'start_dt') ); self::assertSame( ['2026-05-30 09:00:00', '2026-05-01 09:00:00'], array_column($result['past'], 'start_dt') ); } public function testRowsWithoutStartDateFallIntoPast(): void { $rows = [ ['start_dt' => '', 'label' => 'no-slot'], ['start_dt' => '2026-06-10 09:00:00', 'label' => 'future'], ]; $result = StudentSchedule::partition($rows, '2026-06-08 00:00:00'); self::assertSame(['future'], array_column($result['upcoming'], 'label')); self::assertSame(['no-slot'], array_column($result['past'], 'label')); } public function testEmptyInput(): void { $result = StudentSchedule::partition([], '2026-06-08 00:00:00'); self::assertSame([], $result['upcoming']); self::assertSame([], $result['past']); } }