diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index a172a0a24..88922d3ad 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.2', '8.3'] + php: ['8.2', '8.3', '8.4'] steps: - uses: actions/checkout@v3 diff --git a/Tests/Unit/Service/CalendarServiceTest.php b/Tests/Unit/Service/CalendarServiceTest.php index 45119c459..470d4abc1 100644 --- a/Tests/Unit/Service/CalendarServiceTest.php +++ b/Tests/Unit/Service/CalendarServiceTest.php @@ -243,26 +243,51 @@ public function getDateConfigReturnsExpectedValues(int $month, int $year, string self::assertEquals($expected, $result); } - #[Test] - public function getWeekConfigReturnsExpectedValue(): void + public static function weekConfigDataProvider(): array { - $firstDayOfWeek = DateTime::createFromFormat('d.m.Y', '3.1.2022')->setTime(0, 0); - - $expected = [ - 'previous' => [ - 'weeknumber' => 52, - 'year' => 2021, - ], - 'current' => [ - 'weeknumber' => 1, - 'year' => 2022, + return [ + '3.1.2022' => [ + '3.1.2022', + [ + 'previous' => [ + 'weeknumber' => 52, + 'year' => 2021, + ], + 'current' => [ + 'weeknumber' => 1, + 'year' => 2022, + ], + 'next' => [ + 'weeknumber' => 2, + 'year' => 2022, + ], + ] ], - 'next' => [ - 'weeknumber' => 2, - 'year' => 2022, + '30.12.2024' => [ + '30.12.2024', + [ + 'previous' => [ + 'weeknumber' => 52, + 'year' => 2024, + ], + 'current' => [ + 'weeknumber' => 1, + 'year' => 2025, + ], + 'next' => [ + 'weeknumber' => 2, + 'year' => 2025, + ], + ] ], ]; + } + #[DataProvider('weekConfigDataProvider')] + #[Test] + public function getWeekConfigReturnsExpectedValue(string $date, array $expected): void + { + $firstDayOfWeek = DateTime::createFromFormat('d.m.Y', $date)->setTime(0, 0); self::assertEquals($expected, $this->subject->getWeekConfig($firstDayOfWeek)); } }