diff --git a/src/Yasumi/Provider/Bulgaria.php b/src/Yasumi/Provider/Bulgaria.php index 1239db36b..cfe96b515 100644 --- a/src/Yasumi/Provider/Bulgaria.php +++ b/src/Yasumi/Provider/Bulgaria.php @@ -32,7 +32,8 @@ public function initialize(): void // // Add common holidays $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); - // $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + // // // Add Catholic holidays // $this->addHoliday($this->easter($this->year, $this->timezone, $this->locale)); diff --git a/src/Yasumi/data/translations/internationalWorkersDay.php b/src/Yasumi/data/translations/internationalWorkersDay.php index d9119c3d4..6120e88cb 100644 --- a/src/Yasumi/data/translations/internationalWorkersDay.php +++ b/src/Yasumi/data/translations/internationalWorkersDay.php @@ -17,6 +17,7 @@ // Translations for International Workers' Day return [ + 'bg' => 'Ден на труда и на международната работническа солидарност', 'bs_Latn' => 'Praznik rada', 'ca' => 'Dia del Treball', 'cs' => 'Svátek práce', diff --git a/tests/Bulgaria/BulgariaTest.php b/tests/Bulgaria/BulgariaTest.php index 6c0740c73..4ffdb24dd 100644 --- a/tests/Bulgaria/BulgariaTest.php +++ b/tests/Bulgaria/BulgariaTest.php @@ -33,6 +33,7 @@ public function testOfficialHolidays(): void { $holidays = [ 'newYearsDay', + 'internationalWorkersDay', ]; if ($this->year >= 1990) { diff --git a/tests/Bulgaria/InternationalWorkersDayTest.php b/tests/Bulgaria/InternationalWorkersDayTest.php new file mode 100644 index 000000000..dde9d0265 --- /dev/null +++ b/tests/Bulgaria/InternationalWorkersDayTest.php @@ -0,0 +1,57 @@ + + */ + +namespace Yasumi\tests\Bulgaria; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +class InternationalWorkersDayTest extends BulgariaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'internationalWorkersDay'; + + public function testHoliday(): void + { + $year = $this->generateRandomYear(); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-05-01", new \DateTimeZone(self::TIMEZONE)) + ); + } + + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Ден на труда и на международната работническа солидарност'] + ); + } + + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Bulgaria/LiberationDayTest.php b/tests/Bulgaria/LiberationDayTest.php index 341dbcb6c..423dc59a6 100644 --- a/tests/Bulgaria/LiberationDayTest.php +++ b/tests/Bulgaria/LiberationDayTest.php @@ -28,7 +28,7 @@ class LiberationDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = self::ESTABLISHMENT_YEAR; + $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -39,15 +39,11 @@ public function testHoliday(): void public function testNotHoliday(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); - } - - /** - * @return array> - */ - public function HolidayDataProvider(): array - { - return $this->generateRandomDates(3, 3, self::TIMEZONE, null, 2000); + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); } public function testTranslation(): void @@ -62,6 +58,11 @@ public function testTranslation(): void public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); } } diff --git a/tests/Bulgaria/NewYearsDayTest.php b/tests/Bulgaria/NewYearsDayTest.php index 1e08f9a35..f964ae214 100644 --- a/tests/Bulgaria/NewYearsDayTest.php +++ b/tests/Bulgaria/NewYearsDayTest.php @@ -24,20 +24,15 @@ class NewYearsDayTest extends BulgariaBaseTestCase implements HolidayTestCase { public const HOLIDAY = 'newYearsDay'; - /** - * @dataProvider HolidayDataProvider - */ - public function testHoliday(int $year, \DateTime $expected): void + public function testHoliday(): void { - $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); - } - - /** - * @return array> - */ - public function HolidayDataProvider(): array - { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + $year = $this->generateRandomYear(); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-01-01", new \DateTimeZone(self::TIMEZONE)) + ); } public function testTranslation(): void @@ -52,6 +47,11 @@ public function testTranslation(): void public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + Holiday::TYPE_OFFICIAL + ); } }