Skip to content

Commit 384b8bf

Browse files
committed
build: update tests for PHPUnit 11
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
1 parent 3a74491 commit 384b8bf

20 files changed

Lines changed: 155 additions & 165 deletions

phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
<testsuite name="Russia">
139139
<directory>./tests/Russia</directory>
140140
</testsuite>
141+
<!-- Test Suite for holidays in San Marino -->
142+
<testsuite name="SanMarino">
143+
<directory>./tests/SanMarino</directory>
144+
</testsuite>
141145
<!-- Test Suite for holidays in Slovakia -->
142146
<testsuite name="Slovakia">
143147
<directory>./tests/Slovakia</directory>

tests/SanMarino/AllSaintsDayTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ class AllSaintsDayTest extends SanMarinoBaseTestCase implements HolidayTestCase
3333
/**
3434
* Tests All Saints' Day.
3535
*
36-
* @dataProvider AllSaintsDayDataProvider
37-
*
38-
* @param int $year the year for which All Saints' Day needs to be tested
36+
* @param int $year the year for which the holiday defined in this test needs to be tested
3937
* @param \DateTime $expected the expected date
4038
*/
41-
public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void
39+
#[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')]
40+
public function testHoliday(int $year, \DateTimeInterface $expected): void
4241
{
4342
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected);
4443
}
4544

4645
/**
47-
* Returns a list of random test dates used for assertion of All Saints' Day.
46+
* Returns a list of random test dates used for assertion of the holiday defined in this test.
4847
*
49-
* @return array<array> list of test dates for All Saints' Day
48+
* @return array<array> list of test dates for the holiday defined in this test
5049
*
5150
* @throws \Exception
5251
*/
53-
public function AllSaintsDayDataProvider(): array
52+
public static function HolidayDataProvider(): array
5453
{
55-
return $this->generateRandomDates(11, 1, self::TIMEZONE);
54+
return static::generateRandomDates(11, 1, self::TIMEZONE);
5655
}
5756

5857
/**
59-
* Tests translated name of All Saints' Day.
58+
* Tests the translated name of All Saints' Day.
6059
*
6160
* @throws \Exception
6261
*/
@@ -65,7 +64,7 @@ public function testTranslation(): void
6564
$this->assertTranslatedHolidayName(
6665
self::REGION,
6766
self::HOLIDAY,
68-
$this->generateRandomYear(),
67+
static::generateRandomYear(),
6968
[self::LOCALE => 'Festa di Tutti i Santi']
7069
);
7170
}
@@ -77,6 +76,6 @@ public function testTranslation(): void
7776
*/
7877
public function testHolidayType(): void
7978
{
80-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
79+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
8180
}
8281
}

tests/SanMarino/AnniversaryOfArengoTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AnniversaryOfArengoTest extends SanMarinoBaseTestCase implements HolidayTe
4343
*/
4444
public function testAnniversaryOfArengoOnAfter1906(): void
4545
{
46-
$year = $this->generateRandomYear(SanMarino::ARENGO_YEAR);
46+
$year = static::generateRandomYear(SanMarino::ARENGO_YEAR);
4747
$this->assertHoliday(
4848
self::REGION,
4949
self::HOLIDAY,
@@ -62,7 +62,7 @@ public function testAnniversaryOfArengoBefore1906(): void
6262
$this->assertNotHoliday(
6363
self::REGION,
6464
self::HOLIDAY,
65-
$this->generateRandomYear(1000, SanMarino::ARENGO_YEAR - 1)
65+
static::generateRandomYear(1000, SanMarino::ARENGO_YEAR - 1)
6666
);
6767
}
6868

@@ -76,7 +76,7 @@ public function testTranslation(): void
7676
$this->assertTranslatedHolidayName(
7777
self::REGION,
7878
self::HOLIDAY,
79-
$this->generateRandomYear(SanMarino::ARENGO_YEAR),
79+
static::generateRandomYear(SanMarino::ARENGO_YEAR),
8080
[self::LOCALE => "Anniversario dell\u{2019}Arengo"]
8181
);
8282
}
@@ -91,7 +91,7 @@ public function testHolidayType(): void
9191
$this->assertHolidayType(
9292
self::REGION,
9393
self::HOLIDAY,
94-
$this->generateRandomYear(SanMarino::ARENGO_YEAR),
94+
static::generateRandomYear(SanMarino::ARENGO_YEAR),
9595
Holiday::TYPE_OFFICIAL
9696
);
9797
}

tests/SanMarino/AssumptionOfMaryTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ class AssumptionOfMaryTest extends SanMarinoBaseTestCase implements HolidayTestC
3333
/**
3434
* Tests the Assumption of Mary.
3535
*
36-
* @dataProvider AssumptionOfMaryDataProvider
37-
*
38-
* @param int $year the year for which the Assumption of Mary needs to be tested
36+
* @param int $year the year for which the holiday defined in this test needs to be tested
3937
* @param \DateTime $expected the expected date
4038
*/
41-
public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void
39+
#[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')]
40+
public function testHoliday(int $year, \DateTimeInterface $expected): void
4241
{
4342
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected);
4443
}
4544

4645
/**
47-
* Returns a list of random test dates used for assertion of the Assumption of Mary.
46+
* Returns a list of random test dates used for assertion of the holiday defined in this test.
4847
*
49-
* @return array<array> list of test dates for the Assumption of Mary
48+
* @return array<array> list of test dates for the holiday defined in this test
5049
*
5150
* @throws \Exception
5251
*/
53-
public function AssumptionOfMaryDataProvider(): array
52+
public static function HolidayDataProvider(): array
5453
{
55-
return $this->generateRandomDates(8, 15, self::TIMEZONE);
54+
return static::generateRandomDates(8, 15, self::TIMEZONE);
5655
}
5756

5857
/**
59-
* Tests translated name of the Assumption of Mary.
58+
* Tests the translated name of the Assumption of Mary.
6059
*
6160
* @throws \Exception
6261
*/
@@ -65,7 +64,7 @@ public function testTranslation(): void
6564
$this->assertTranslatedHolidayName(
6665
self::REGION,
6766
self::HOLIDAY,
68-
$this->generateRandomYear(),
67+
static::generateRandomYear(),
6968
[self::LOCALE => 'Assunzione di Maria Vergine']
7069
);
7170
}
@@ -77,6 +76,6 @@ public function testTranslation(): void
7776
*/
7877
public function testHolidayType(): void
7978
{
80-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
79+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
8180
}
8281
}

tests/SanMarino/ChristmasDayTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ class ChristmasDayTest extends SanMarinoBaseTestCase implements HolidayTestCase
3333
/**
3434
* Tests Christmas Day.
3535
*
36-
* @dataProvider ChristmasDayDataProvider
37-
*
38-
* @param int $year the year for which Christmas Day needs to be tested
36+
* @param int $year the year for which the holiday defined in this test needs to be tested
3937
* @param \DateTime $expected the expected date
4038
*/
41-
public function testChristmasDay(int $year, \DateTimeInterface $expected): void
39+
#[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')]
40+
public function testHoliday(int $year, \DateTimeInterface $expected): void
4241
{
4342
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected);
4443
}
4544

4645
/**
47-
* Returns a list of random test dates used for assertion of Christmas Day.
46+
* Returns a list of random test dates used for assertion of the holiday defined in this test.
4847
*
49-
* @return array<array> list of test dates for Christmas Day
48+
* @return array<array> list of test dates for the holiday defined in this test
5049
*
5150
* @throws \Exception
5251
*/
53-
public function ChristmasDayDataProvider(): array
52+
public static function HolidayDataProvider(): array
5453
{
55-
return $this->generateRandomDates(12, 25, self::TIMEZONE);
54+
return static::generateRandomDates(12, 25, self::TIMEZONE);
5655
}
5756

5857
/**
59-
* Tests translated name of Christmas Day.
58+
* Tests the translated name of Christmas Day.
6059
*
6160
* @throws \Exception
6261
*/
@@ -65,7 +64,7 @@ public function testTranslation(): void
6564
$this->assertTranslatedHolidayName(
6665
self::REGION,
6766
self::HOLIDAY,
68-
$this->generateRandomYear(),
67+
static::generateRandomYear(),
6968
[self::LOCALE => 'Natale']
7069
);
7170
}
@@ -77,6 +76,6 @@ public function testTranslation(): void
7776
*/
7877
public function testHolidayType(): void
7978
{
80-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
79+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
8180
}
8281
}

tests/SanMarino/CommemorationOfTheFallenTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,29 @@ class CommemorationOfTheFallenTest extends SanMarinoBaseTestCase implements Holi
3838
/**
3939
* Tests the Commemoration of the Fallen.
4040
*
41-
* @dataProvider CommemorationOfTheFallenDataProvider
42-
*
43-
* @param int $year the year for which the holiday needs to be tested
41+
* @param int $year the year for which the holiday defined in this test needs to be tested
4442
* @param \DateTime $expected the expected date
4543
*/
46-
public function testCommemorationOfTheFallen(int $year, \DateTimeInterface $expected): void
44+
#[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')]
45+
public function testHoliday(int $year, \DateTimeInterface $expected): void
4746
{
4847
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected);
4948
}
5049

5150
/**
52-
* Returns a list of random test dates used for assertion of the Commemoration of the Fallen.
51+
* Returns a list of random test dates used for assertion of the holiday defined in this test.
5352
*
54-
* @return array<array> list of test dates
53+
* @return array<array> list of test dates for the holiday defined in this test
5554
*
5655
* @throws \Exception
5756
*/
58-
public function CommemorationOfTheFallenDataProvider(): array
57+
public static function HolidayDataProvider(): array
5958
{
60-
return $this->generateRandomDates(11, 2, self::TIMEZONE);
59+
return static::generateRandomDates(11, 2, self::TIMEZONE);
6160
}
6261

6362
/**
64-
* Tests translated name of the Commemoration of the Fallen.
63+
* Tests the translated name of the Commemoration of the Fallen.
6564
*
6665
* @throws \Exception
6766
*/
@@ -70,7 +69,7 @@ public function testTranslation(): void
7069
$this->assertTranslatedHolidayName(
7170
self::REGION,
7271
self::HOLIDAY,
73-
$this->generateRandomYear(),
72+
static::generateRandomYear(),
7473
[self::LOCALE => 'Commemorazione dei Defunti']
7574
);
7675
}
@@ -82,6 +81,6 @@ public function testTranslation(): void
8281
*/
8382
public function testHolidayType(): void
8483
{
85-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
84+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
8685
}
8786
}

tests/SanMarino/CorpusChristiTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,25 @@ class CorpusChristiTest extends SanMarinoBaseTestCase implements HolidayTestCase
3737
/**
3838
* Tests Corpus Christi.
3939
*
40-
* @dataProvider CorpusChristiDataProvider
41-
*
42-
* @param int $year the year for which Corpus Christi needs to be tested
40+
* @param int $year the year for which the holiday defined in this test needs to be tested
4341
* @param \DateTime $expected the expected date
4442
*
4543
* @throws \Exception
4644
*/
45+
#[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')]
4746
public function testHoliday(int $year, \DateTimeInterface $expected): void
4847
{
4948
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected);
5049
}
5150

5251
/**
53-
* Returns a list of test dates used for assertion of Corpus Christi.
52+
* Returns a list of test dates used for assertion of the holiday defined in this test.
5453
*
55-
* @return array<array> list of test dates for Corpus Christi
54+
* @return array<array> list of test dates for the holiday defined in this test
5655
*
5756
* @throws \Exception
5857
*/
59-
public function CorpusChristiDataProvider(): array
58+
public static function HolidayDataProvider(): array
6059
{
6160
return [
6261
[2020, new \DateTime('2020-6-11', new \DateTimeZone(self::TIMEZONE))],
@@ -70,7 +69,7 @@ public function CorpusChristiDataProvider(): array
7069
}
7170

7271
/**
73-
* Tests translated name of Corpus Christi.
72+
* Tests the translated name of Corpus Christi.
7473
*
7574
* @throws \Exception
7675
*/
@@ -79,7 +78,7 @@ public function testTranslation(): void
7978
$this->assertTranslatedHolidayName(
8079
self::REGION,
8180
self::HOLIDAY,
82-
$this->generateRandomYear(),
81+
static::generateRandomYear(),
8382
[self::LOCALE => 'Corpus Domini']
8483
);
8584
}
@@ -91,6 +90,6 @@ public function testTranslation(): void
9190
*/
9291
public function testHolidayType(): void
9392
{
94-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
93+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
9594
}
9695
}

tests/SanMarino/EasterMondayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testTranslation(): void
5656
$this->assertTranslatedHolidayName(
5757
self::REGION,
5858
self::HOLIDAY,
59-
$this->generateRandomYear(),
59+
static::generateRandomYear(),
6060
[self::LOCALE => "Lunedì dell\u{2019}Angelo"]
6161
);
6262
}
@@ -68,6 +68,6 @@ public function testTranslation(): void
6868
*/
6969
public function testHolidayType(): void
7070
{
71-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
71+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
7272
}
7373
}

tests/SanMarino/EasterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testTranslation(): void
5656
$this->assertTranslatedHolidayName(
5757
self::REGION,
5858
self::HOLIDAY,
59-
$this->generateRandomYear(),
59+
static::generateRandomYear(),
6060
[self::LOCALE => 'Pasqua']
6161
);
6262
}
@@ -68,6 +68,6 @@ public function testTranslation(): void
6868
*/
6969
public function testHolidayType(): void
7070
{
71-
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL);
71+
$this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL);
7272
}
7373
}

0 commit comments

Comments
 (0)