21
21
use Yasumi \tests \HolidayTestCase ;
22
22
23
23
/**
24
- * Class for testing Day of Liberation 2020 in Berlin (Germany).
24
+ * Class for testing Day of Liberation in Berlin (Germany).
25
25
*/
26
- class DayOfLiberation2020Test extends BerlinBaseTestCase implements HolidayTestCase
26
+ class DayOfLiberationTest extends BerlinBaseTestCase implements HolidayTestCase
27
27
{
28
28
/**
29
29
* The name of the holiday to be tested.
30
30
*/
31
31
public const HOLIDAY = 'dayOfLiberation ' ;
32
32
33
33
/**
34
- * The year in which the holiday takes place.
34
+ * The years in which the holiday takes place.
35
35
*/
36
- public const YEAR = 2020 ;
36
+ public static array $ years = [ 2020 , 2025 ] ;
37
37
38
38
/**
39
39
* Test the holiday defined in this test.
@@ -42,12 +42,14 @@ class DayOfLiberation2020Test extends BerlinBaseTestCase implements HolidayTestC
42
42
*/
43
43
public function testHolidayInYear (): void
44
44
{
45
- $ this ->assertHoliday (
46
- self ::REGION ,
47
- self ::HOLIDAY ,
48
- self ::YEAR ,
49
- new \DateTime (self ::YEAR . '-05-08 ' , new \DateTimeZone (self ::TIMEZONE ))
50
- );
45
+ foreach (self ::$ years as $ year ) {
46
+ $ this ->assertHoliday (
47
+ self ::REGION ,
48
+ self ::HOLIDAY ,
49
+ $ year ,
50
+ new \DateTime ($ year . '-05-08 ' , new \DateTimeZone (self ::TIMEZONE ))
51
+ );
52
+ }
51
53
}
52
54
53
55
/**
@@ -57,10 +59,12 @@ public function testHolidayInYear(): void
57
59
*/
58
60
public function testHolidayBeforeYear (): void
59
61
{
62
+ reset (self ::$ years );
63
+
60
64
$ this ->assertNotHoliday (
61
65
self ::REGION ,
62
66
self ::HOLIDAY ,
63
- $ this ->generateRandomYear (1000 , self ::YEAR - 1 )
67
+ $ this ->generateRandomYear (1000 , current ( self ::$ years ) - 1 )
64
68
);
65
69
}
66
70
@@ -71,10 +75,12 @@ public function testHolidayBeforeYear(): void
71
75
*/
72
76
public function testHolidayAfterYear (): void
73
77
{
78
+ end (self ::$ years );
79
+
74
80
$ this ->assertNotHoliday (
75
81
self ::REGION ,
76
82
self ::HOLIDAY ,
77
- $ this ->generateRandomYear (self ::YEAR + 1 )
83
+ $ this ->generateRandomYear (current ( self ::$ years ) + 1 )
78
84
);
79
85
}
80
86
@@ -83,10 +89,12 @@ public function testHolidayAfterYear(): void
83
89
*/
84
90
public function testTranslation (): void
85
91
{
92
+ reset (self ::$ years );
93
+
86
94
$ this ->assertTranslatedHolidayName (
87
95
self ::REGION ,
88
96
self ::HOLIDAY ,
89
- self ::YEAR ,
97
+ current ( self ::$ years ) ,
90
98
[self ::LOCALE => 'Tag der Befreiung ' ]
91
99
);
92
100
}
@@ -96,10 +104,12 @@ public function testTranslation(): void
96
104
*/
97
105
public function testHolidayType (): void
98
106
{
107
+ reset (self ::$ years );
108
+
99
109
$ this ->assertHolidayType (
100
110
self ::REGION ,
101
111
self ::HOLIDAY ,
102
- self ::YEAR ,
112
+ current ( self ::$ years ) ,
103
113
Holiday::TYPE_OFFICIAL
104
114
);
105
115
}
0 commit comments