dispositionRepository = $this->createMock(DispositionRepository::class); $this->counter = new SeasonDispositionCounter( $this->dispositionRepository, new SeasonCalendar('11-01', '04-01'), ); } public function testCountsAreGroupedPerSeasonNewestFirstWithOffSeasonLast(): void { $this->stubDates([ '2024-12-10', // Saison 2024/25 '2025-02-01', // Saison 2024/25 '2024-01-15', // Saison 2023/24 '2025-07-20', // außerhalb der Saison ]); $this->assertSame([ ['label' => 'Saison 2024/25', 'count' => 2], ['label' => 'Saison 2023/24', 'count' => 1], ['label' => 'außerhalb der Saison', 'count' => 1], ], $this->counter->countPerSeason(new Teamer())); } public function testATeamerWithNoDispositionsYieldsNoRows(): void { $this->stubDates([]); $this->assertSame([], $this->counter->countPerSeason(new Teamer())); } public function testOnlyOffSeasonDispositionsYieldASingleRow(): void { $this->stubDates(['2025-05-01', '2025-09-30']); $this->assertSame([ ['label' => 'außerhalb der Saison', 'count' => 2], ], $this->counter->countPerSeason(new Teamer())); } /** * @param list $dates */ private function stubDates(array $dates): void { $this->dispositionRepository ->method('findDispositionSeasonDatesByTeamer') ->willReturn(array_map(static fn (string $date): array => ['seasonDate' => $date], $dates)) ; } }