-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
IndependenceMovementDayTest.php
139 lines (125 loc) · 3.34 KB
/
IndependenceMovementDayTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
declare(strict_types = 1);
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/
namespace Yasumi\tests\SouthKorea;
use Yasumi\Holiday;
use Yasumi\tests\HolidayTestCase;
/**
* Class for testing Independence Movement Day in South Korea.
*/
class IndependenceMovementDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase
{
/**
* The name of the holiday.
*/
public const HOLIDAY = 'independenceMovementDay';
/**
* The year in which the holiday was first established.
*/
public const ESTABLISHMENT_YEAR = 1949;
/**
* Tests the holiday defined in this test.
*
* @throws \Exception
*/
public function testHoliday(): void
{
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR);
$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
new \DateTime("{$year}-3-1", new \DateTimeZone(self::TIMEZONE))
);
}
/**
* Tests the substitute holiday defined in this test.
*
* @throws \Exception
*/
public function testSubstituteHoliday(): void
{
$tz = new \DateTimeZone(self::TIMEZONE);
// Before 2022
$this->assertNotSubstituteHoliday(self::REGION, self::HOLIDAY, 2020);
// By saturday
$this->assertSubstituteHoliday(
self::REGION,
self::HOLIDAY,
2025,
new \DateTime('2025-3-3', $tz)
);
$this->assertSubstituteHoliday(
self::REGION,
self::HOLIDAY,
2031,
new \DateTime('2031-3-3', $tz)
);
// By sunday
$this->assertSubstituteHoliday(
self::REGION,
self::HOLIDAY,
2026,
new \DateTime('2026-3-2', $tz)
);
// By sunday
$this->assertSubstituteHoliday(
self::REGION,
self::HOLIDAY,
2037,
new \DateTime('2037-3-2', $tz)
);
}
/**
* Tests the holiday defined in this test before establishment.
*
* @throws \Exception
*/
public function testHolidayBeforeEstablishment(): void
{
$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 \Exception
*/
public function testTranslation(): void
{
$this->assertTranslatedHolidayName(
self::REGION,
self::HOLIDAY,
$this->generateRandomYear(self::ESTABLISHMENT_YEAR),
[self::LOCALE => '삼일절']
);
}
/**
* Tests type of the holiday defined in this test.
*
* @throws \Exception
*/
public function testHolidayType(): void
{
$this->assertHolidayType(
self::REGION,
self::HOLIDAY,
$this->generateRandomYear(self::ESTABLISHMENT_YEAR),
Holiday::TYPE_OFFICIAL
);
}
}