-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provider for holidays in South Korea (#156)
* support Korean translations * add provider for holidays in South Korea * add tests for holidays in South Korea * fix Hangul Day test logic
- Loading branch information
1 parent
56c693c
commit e7a4e02
Showing
29 changed files
with
2,393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
return [ | ||
'en_NZ' => 'Day after New Year\'s Day', | ||
'en_US' => 'Day after New Year\'s Day', | ||
'ko_KR' => '새해 연휴', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ | |
return [ | ||
'da_DK' => 'Sommertid starter', | ||
'en_US' => 'Summertime', | ||
'ko_KR' => '서머타임', | ||
'nl_NL' => 'Zomertijd', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 - 2019 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <me@sachatelgenhof.com> | ||
*/ | ||
|
||
namespace Yasumi\tests\SouthKorea; | ||
|
||
use DateTime; | ||
use DateTimeZone; | ||
use Yasumi\Holiday; | ||
use Yasumi\tests\YasumiTestCaseInterface; | ||
|
||
/** | ||
* Class for testing day after Arbor Day in South Korea. | ||
*/ | ||
class ArborDayTest extends SouthKoreaBaseTestCase implements YasumiTestCaseInterface | ||
{ | ||
/** | ||
* The name of the holiday | ||
*/ | ||
public const HOLIDAY = 'arborDay'; | ||
|
||
/** | ||
* The year in which the holiday was first established | ||
*/ | ||
public const ESTABLISHMENT_YEAR = 1949; | ||
|
||
/** | ||
* The year in which the holiday was removed | ||
*/ | ||
public const REMOVED_YEAR = 2005; | ||
|
||
/** | ||
* Tests the holiday defined in this test. | ||
* @throws \Exception | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHoliday() | ||
{ | ||
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); | ||
if ($year === 1960) { | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$year | ||
); | ||
} else { | ||
$this->assertHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$year, | ||
new DateTime("$year-4-5", new DateTimeZone(self::TIMEZONE)) | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test after removal. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHolidayAfterRemoval() | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(self::REMOVED_YEAR + 1) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test before establishment. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHolidayBeforeEstablishment() | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the translated name of the holiday defined in this test. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testTranslation(): void | ||
{ | ||
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); | ||
if ($year !== 1960) { | ||
$this->assertTranslatedHolidayName( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$year, | ||
[self::LOCALE => '식목일'] | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Tests type of the holiday defined in this test. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHolidayType(): void | ||
{ | ||
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); | ||
if ($year !== 1960) { | ||
$this->assertHolidayType( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$year, | ||
Holiday::TYPE_OFFICIAL | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 - 2019 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <me@sachatelgenhof.com> | ||
*/ | ||
|
||
namespace Yasumi\tests\SouthKorea; | ||
|
||
use DateTime; | ||
use DateTimeZone; | ||
use Yasumi\Holiday; | ||
use Yasumi\tests\YasumiTestCaseInterface; | ||
|
||
/** | ||
* Class for testing day after Armed Forces Day in South Korea. | ||
*/ | ||
class ArmedForcesDayTest extends SouthKoreaBaseTestCase implements YasumiTestCaseInterface | ||
{ | ||
/** | ||
* The name of the holiday | ||
*/ | ||
public const HOLIDAY = 'armedForcesDay'; | ||
|
||
/** | ||
* The year in which the holiday was first established | ||
*/ | ||
public const ESTABLISHMENT_YEAR = 1956; | ||
|
||
/** | ||
* The year in which the holiday was removed | ||
*/ | ||
public const REMOVED_YEAR = 1990; | ||
|
||
/** | ||
* Tests the holiday defined in this test. | ||
* @throws \Exception | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHoliday() | ||
{ | ||
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); | ||
$this->assertHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$year, | ||
new DateTime("$year-10-1", new DateTimeZone(self::TIMEZONE)) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test after removal. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHolidayAfterRemoval() | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(self::REMOVED_YEAR + 1) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test before establishment. | ||
* @throws \ReflectionException | ||
*/ | ||
public function testHolidayBeforeEstablishment() | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) | ||
); | ||
} | ||
|
||
/** | ||
* 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::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), | ||
[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(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), | ||
Holiday::TYPE_OFFICIAL | ||
); | ||
} | ||
} |
Oops, something went wrong.