diff --git a/src/Yasumi/Provider/Georgia.php b/src/Yasumi/Provider/Georgia.php new file mode 100644 index 000000000..a40e53a50 --- /dev/null +++ b/src/Yasumi/Provider/Georgia.php @@ -0,0 +1,231 @@ + + */ + +namespace Yasumi\Provider; + +use Yasumi\Holiday; + +/** + * Provider for all holidays in Georgia. + * + * @author Zurab Sardarov + */ +class Georgia extends AbstractProvider +{ + use CommonHolidays; + use ChristianHolidays; + + public const PROCLAMATION_OF_INDEPENDENCE_YEAR = 1918; + + public const APRIL_NINE_TRAGEDY_YEAR = 1989; + + /** + * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'GE'; + + /** + * Initialize holidays for Georgia. + * + * @throws \InvalidArgumentException + * @throws \Exception + */ + public function initialize(): void + { + $this->timezone = 'Asia/Tbilisi'; + + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWomensDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easter($this->year, $this->timezone, $this->locale)); + + $this->addSecondNewYearDay(); + $this->addOrthodoxChristmasDay(); + $this->addIndependenceDay(); + $this->addMothersDay(); + $this->addUnityDay(); + $this->addVictoryDay(); + $this->addStAndrewsDay(); + $this->addOrthodoxEpiphanyDay(); + $this->addMtskhetobaDay(); + $this->addStMarysDay(); + $this->addStGeorgesDay(); + } + + /** + * @throws \Exception + */ + public function calculateEaster(int $year, string $timezone): \DateTime + { + return $this->calculateOrthodoxEaster($year, $timezone); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addOrthodoxChristmasDay(): void + { + $date = new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('orthodoxChristmasDay', [ + 'en' => 'Orthodox Christmas Day', + 'ka' => 'ქრისტეს შობა', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addIndependenceDay(): void + { + if ($this->year >= self::PROCLAMATION_OF_INDEPENDENCE_YEAR) { + $date = new \DateTime("{$this->year}-05-26", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('independenceDay', [ + 'en' => 'Independence Day', + 'ka' => 'საქართველოს დამოუკიდებლობის დღე', + ], $date, $this->locale)); + } + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addUnityDay(): void + { + if ($this->year >= self::APRIL_NINE_TRAGEDY_YEAR) { + $date = new \DateTime("{$this->year}-04-09", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('unityDay', [ + 'en' => 'National Unity Day', + 'ka' => 'ეროვნული ერთიანობის დღე', + ], $date, $this->locale)); + } + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addMothersDay(): void + { + $date = new \DateTime("{$this->year}-03-03", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('mothersDay', [ + 'en' => 'Mothers Day', + 'ka' => 'დედის დღე', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addVictoryDay() + { + $date = new \DateTime("{$this->year}-05-09", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('victoryDay', [ + 'en' => 'Day of Victory over Fascism', + 'ka' => 'ფაშიზმზე გამარჯვების დღე', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addStAndrewsDay(): void + { + $date = new \DateTime("{$this->year}-05-12", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('stAndrewsDay', [ + 'en' => 'Saint Andrew the First-Called Day', + 'ka' => 'წმინდა ანდრია პირველწოდებულის ხსენების დღე', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addOrthodoxEpiphanyDay(): void + { + $date = new \DateTime("{$this->year}-01-19", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('orthodoxEpiphanyDay', [ + 'en' => 'Orthodox Epiphany Day', + 'ka' => 'ნათლისღება', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addStMarysDay(): void + { + $date = new \DateTime("{$this->year}-08-28", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('stMarysDay', [ + 'en' => 'Saint Marys Day', + 'ka' => 'მარიამობა', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addMtskhetobaDay(): void + { + $date = new \DateTime("{$this->year}-10-14", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('mtskhetobaDay', [ + 'en' => 'Day of Svetitskhoveli Cathedral', + 'ka' => 'მცხეთობა', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addStGeorgesDay(): void + { + $date = new \DateTime("{$this->year}-11-23", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('stGeorgesDay', [ + 'en' => 'Saint Georges Day', + 'ka' => 'გიორგობა', + ], $date, $this->locale)); + } + + /** + * @throws \InvalidArgumentException + * @throws \Exception + */ + private function addSecondNewYearDay(): void + { + $date = new \DateTime("$this->year-01-02", new \DateTimeZone($this->timezone)); + + $this->addHoliday(new Holiday('secondDayOfNewYear', [ + 'en' => 'Second day of the New Year', + 'ka' => 'ბედობა', + ], $date, $this->locale)); + } +} diff --git a/src/Yasumi/data/translations/easter.php b/src/Yasumi/data/translations/easter.php index 2c9be1a1d..b874d07e1 100644 --- a/src/Yasumi/data/translations/easter.php +++ b/src/Yasumi/data/translations/easter.php @@ -30,6 +30,7 @@ 'hr' => 'Uskrs', 'hu' => 'Húsvét', 'it' => 'Pasqua', + 'ka' => 'აღდგომა', 'lt' => 'Velykos', 'lv' => 'Lieldienas', 'nb' => 'første påskedag', diff --git a/src/Yasumi/data/translations/internationalWomensDay.php b/src/Yasumi/data/translations/internationalWomensDay.php index 3ad17d61e..8653a76fc 100755 --- a/src/Yasumi/data/translations/internationalWomensDay.php +++ b/src/Yasumi/data/translations/internationalWomensDay.php @@ -17,6 +17,7 @@ return [ 'de' => 'Internationaler Frauentag', 'en' => 'International Women’s Day', + 'ka' => 'ქალთა საერთაშორისო დღე', 'ko' => '국제 여성의 날', 'ru' => 'Международный женский день', 'uk' => 'Міжнародний жіночий день', diff --git a/src/Yasumi/data/translations/newYearsDay.php b/src/Yasumi/data/translations/newYearsDay.php index 862f17703..d98a398b7 100755 --- a/src/Yasumi/data/translations/newYearsDay.php +++ b/src/Yasumi/data/translations/newYearsDay.php @@ -34,6 +34,7 @@ 'hu' => 'Újév', 'it' => 'Capodanno', 'ja' => '元日', + 'ka' => 'ახალი წელი', 'ko' => '새해', 'lt' => 'Naujųjų metų diena', 'lv' => 'Jaunais Gads', diff --git a/tests/Georgia/EasterTest.php b/tests/Georgia/EasterTest.php new file mode 100644 index 000000000..5481a9a7e --- /dev/null +++ b/tests/Georgia/EasterTest.php @@ -0,0 +1,63 @@ +assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("$year-04-28", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'აღდგომა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/GeorgiaBaseTestCase.php b/tests/Georgia/GeorgiaBaseTestCase.php new file mode 100644 index 000000000..2ecb97e07 --- /dev/null +++ b/tests/Georgia/GeorgiaBaseTestCase.php @@ -0,0 +1,42 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Georgia holiday provider. + */ +abstract class GeorgiaBaseTestCase extends TestCase +{ + use YasumiBase; + + /** + * Name of the country to be tested. + */ + public const REGION = 'Georgia'; + + /** + * Timezone in which this provider has holidays defined. + */ + public const TIMEZONE = 'Asia/Tbilisi'; + + /** + * Locale that is considered common for this provider. + */ + public const LOCALE = 'ka_GE'; +} diff --git a/tests/Georgia/GeorgiaTest.php b/tests/Georgia/GeorgiaTest.php new file mode 100644 index 000000000..09a28589b --- /dev/null +++ b/tests/Georgia/GeorgiaTest.php @@ -0,0 +1,113 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\Provider\Georgia; + +/** + * Class for testing holidays in Georgia. + * + * @author Zurab Sardarov + */ +class GeorgiaTest extends GeorgiaBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Initial setup of this Test Case. + */ + protected function setUp(): void + { + $this->year = $this->generateRandomYear(); + } + + /** + * Tests if all official holidays in Georgia are defined by the provider class. + * + * @throws ReflectionException + */ + public function testOfficialHolidays(): void + { + $holidays = [ + 'easter', + 'victoryDay', + 'mothersDay', + 'newYearsDay', + 'internationalWomensDay', + 'secondDayOfNewYear', + 'orthodoxChristmasDay', + 'stAndrewsDay', + 'orthodoxEpiphanyDay', + 'mtskhetobaDay', + 'stMarysDay', + 'stGeorgesDay', + ]; + + if ($this->year >= Georgia::PROCLAMATION_OF_INDEPENDENCE_YEAR) { + $holidays[] = 'independenceDay'; + } + if ($this->year >= Georgia::APRIL_NINE_TRAGEDY_YEAR) { + $holidays[] = 'unityDay'; + } + + $this->assertDefinedHolidays($holidays, self::REGION, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all observed holidays in Georgia are defined by the provider class. + * + * @throws ReflectionException + */ + public function testObservedHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in Georgia are defined by the provider class. + * + * @throws ReflectionException + */ + public function testSeasonalHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in Georgia are defined by the provider class. + * + * @throws ReflectionException + */ + public function testBankHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in Georgia are defined by the provider class. + * + * @throws ReflectionException + */ + public function testOtherHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } +} diff --git a/tests/Georgia/IndependenceDayTest.php b/tests/Georgia/IndependenceDayTest.php new file mode 100644 index 000000000..83e568b52 --- /dev/null +++ b/tests/Georgia/IndependenceDayTest.php @@ -0,0 +1,75 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use DateTimeZone; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class IndependenceDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'independenceDay'; + + /** + * @throws ReflectionException + * @throws Exception + */ + public function testHoliday(): void + { + $year = 2019; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("{$year}-05-26", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $year = 2019; + + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $year, + [self::LOCALE => 'საქართველოს დამოუკიდებლობის დღე'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $year = 2019; + + $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/InternationalWomensDayTest.php b/tests/Georgia/InternationalWomensDayTest.php new file mode 100644 index 000000000..895d35f03 --- /dev/null +++ b/tests/Georgia/InternationalWomensDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class InternationalWomensDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'internationalWomensDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(3, 8, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ქალთა საერთაშორისო დღე'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/MtskhetobaDayTest.php b/tests/Georgia/MtskhetobaDayTest.php new file mode 100644 index 000000000..1e20a9f49 --- /dev/null +++ b/tests/Georgia/MtskhetobaDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class MtskhetobaDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'mtskhetobaDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(10, 14, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'მცხეთობა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/NewYearsDayTest.php b/tests/Georgia/NewYearsDayTest.php new file mode 100644 index 000000000..1709219f3 --- /dev/null +++ b/tests/Georgia/NewYearsDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class NewYearsDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'newYearsDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ახალი წელი'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/OrthodoxChristmasDayTest.php b/tests/Georgia/OrthodoxChristmasDayTest.php new file mode 100644 index 000000000..8b983b9e1 --- /dev/null +++ b/tests/Georgia/OrthodoxChristmasDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class OrthodoxChristmasDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'orthodoxChristmasDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 7, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ქრისტეს შობა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/OrthodoxEpiphanyDayTest.php b/tests/Georgia/OrthodoxEpiphanyDayTest.php new file mode 100644 index 000000000..459b727b5 --- /dev/null +++ b/tests/Georgia/OrthodoxEpiphanyDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class OrthodoxEpiphanyDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'orthodoxEpiphanyDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 19, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ნათლისღება'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/SecondNewYearDayTest.php b/tests/Georgia/SecondNewYearDayTest.php new file mode 100644 index 000000000..4c98273a0 --- /dev/null +++ b/tests/Georgia/SecondNewYearDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class SecondNewYearDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'secondDayOfNewYear'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(1, 2, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ბედობა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/StAndrewsDayTest.php b/tests/Georgia/StAndrewsDayTest.php new file mode 100644 index 000000000..c0138c8fa --- /dev/null +++ b/tests/Georgia/StAndrewsDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class StAndrewsDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'stAndrewsDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(5, 12, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'წმინდა ანდრია პირველწოდებულის ხსენების დღე'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/StGeorgesDayTest.php b/tests/Georgia/StGeorgesDayTest.php new file mode 100644 index 000000000..413a7c288 --- /dev/null +++ b/tests/Georgia/StGeorgesDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class StGeorgesDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'stGeorgesDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(11, 23, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'გიორგობა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/StMarysDayTest.php b/tests/Georgia/StMarysDayTest.php new file mode 100644 index 000000000..9e5d89687 --- /dev/null +++ b/tests/Georgia/StMarysDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class StMarysDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'stMarysDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(8, 28, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'მარიამობა'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/UnityDayTest.php b/tests/Georgia/UnityDayTest.php new file mode 100644 index 000000000..d015b3a82 --- /dev/null +++ b/tests/Georgia/UnityDayTest.php @@ -0,0 +1,75 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use DateTimeZone; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class UnityDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'unityDay'; + + /** + * @throws ReflectionException + * @throws Exception + */ + public function testHoliday(): void + { + $year = 2019; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime("{$year}-04-09", new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $year = 2019; + + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $year, + [self::LOCALE => 'ეროვნული ერთიანობის დღე'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $year = 2019; + + $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Georgia/VictoryDayTest.php b/tests/Georgia/VictoryDayTest.php new file mode 100644 index 000000000..d50bf8da2 --- /dev/null +++ b/tests/Georgia/VictoryDayTest.php @@ -0,0 +1,77 @@ + + */ + +namespace Yasumi\tests\Georgia; + +use DateTime; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +class VictoryDayTest extends GeorgiaBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday to be tested. + */ + public const HOLIDAY = 'victoryDay'; + + /** + * @dataProvider HolidayDataProvider + * + * @throws ReflectionException + */ + public function testHoliday(int $year, DateTime $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test. + * + * @return array list of test dates for the holiday defined in this test + * + * @throws Exception + */ + public function HolidayDataProvider(): array + { + return $this->generateRandomDates(5, 9, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'ფაშიზმზე გამარჯვების დღე'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws ReflectionException + */ + public function testHolidayType() + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +}