forked from azuyalabs/yasumi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVernalEquinoxDayTest.php
135 lines (124 loc) · 4.06 KB
/
VernalEquinoxDayTest.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
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2020 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <[email protected]>
*/
namespace Yasumi\tests\Japan;
use DateTime;
use DateTimeZone;
use Exception;
use ReflectionException;
use Yasumi\Holiday;
use Yasumi\tests\YasumiTestCaseInterface;
/**
* Class testing Vernal Equinox Day in Japan.
*/
class VernalEquinoxDayTest extends JapanBaseTestCase implements YasumiTestCaseInterface
{
/**
* The name of the holiday
*/
public const HOLIDAY = 'vernalEquinoxDay';
/**
* The year in which the holiday was first established
*/
public const ESTABLISHMENT_YEAR = 1948;
/**
* Tests Vernal Equinox Day after 2150. This national holiday was established in 1948 as a day for the admiration
* of nature and the love of living things. Prior to 1948, the vernal equinox was an imperial ancestor worship
* festival called Shunki kōrei-sai (春季皇霊祭).
*
* After 2150 no calculations are available yet.
* @throws ReflectionException
*/
public function testVernalEquinoxDayOnAfter2150()
{
$this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(2151));
}
/**
* Tests Vernal Equinox Day between 1948 and 2150. This national holiday was established in 1948 as a day for the
* admiration of nature and the love of living things. Prior to 1948, the vernal equinox was an imperial ancestor
* worship festival called Shunki kōrei-sai (春季皇霊祭).
*
* After 2150 no calculations are available yet.
*
* @dataProvider vernalEquinoxHolidaysProvider
*
* @param int $year year of example data to be tested
* @param int $month month (number) of example data to be tested
* @param int $day day of the month (number) of example data to be tested
*
* @throws ReflectionException
* @throws Exception
*/
public function testVernalEquinoxDayBetween1948And2150($year, $month, $day)
{
$this->assertHoliday(
self::REGION,
self::HOLIDAY,
$year,
new DateTime("$year-$month-$day", new DateTimeZone(self::TIMEZONE))
);
}
/**
* Returns a list of all Japanese Vernal Equinox holidays used for assertions.
*
* @return array list of Japanese Vernal Equinox holidays
*/
public function vernalEquinoxHolidaysProvider(): array
{
return [
[1948, 3, 22],
[2013, 3, 20],
[2016, 3, 20],
[2025, 3, 20],
[2143, 3, 21],
];
}
/**
* Tests Vernal Equinox Day before 1948. This national holiday was established in 1948 as a day for the admiration
* of nature and the love of living things. Prior to 1948, the vernal equinox was an imperial ancestor worship
* festival called Shunki kōrei-sai (春季皇霊祭).
* @throws ReflectionException
*/
public function testVernalEquinoxDayBefore1948()
{
$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, 2150),
[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, 2150),
Holiday::TYPE_OFFICIAL
);
}
}