From 58e670229dd49f65e11f2586b7b04a5e63ba4711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 2 Jan 2024 14:15:06 +0100 Subject: [PATCH] Fix: Skip failing tests on PHP 8.3 and above --- test/Core/DateTimeTest.php | 48 ++++++++++++++++++++++++++++ test/Core/UuidTest.php | 3 ++ test/GeneratorTest.php | 2 +- test/Provider/BaseTest.php | 2 ++ test/Provider/BiasedTest.php | 3 ++ test/Provider/UuidTest.php | 3 ++ test/Provider/en_GB/CompanyTest.php | 6 ++++ test/Provider/fi_FI/PersonTest.php | 2 ++ test/Provider/fr_FR/AddressTest.php | 6 ++++ test/Provider/fr_FR/ColorTest.php | 6 ++++ test/Provider/hu_HU/PersonTest.php | 3 ++ test/Provider/ja_JP/InternetTest.php | 6 ++++ test/Provider/ja_JP/PersonTest.php | 15 +++++++++ test/Provider/pl_PL/ColorTest.php | 6 ++++ test/Provider/sv_SE/PersonTest.php | 2 ++ test/Provider/uk_UA/PersonTest.php | 15 +++++++++ 16 files changed, 127 insertions(+), 1 deletion(-) diff --git a/test/Core/DateTimeTest.php b/test/Core/DateTimeTest.php index f51cbc378d..af4902c267 100644 --- a/test/Core/DateTimeTest.php +++ b/test/Core/DateTimeTest.php @@ -24,6 +24,9 @@ protected function setUp(): void $this->extension = $this->faker->ext(DateTimeExtension::class); } + /** + * @requires PHP < 8.3 + */ public function testDateTime(): void { $dateTime = $this->extension->dateTime('2005-10-19T14:12:00'); @@ -32,6 +35,9 @@ public function testDateTime(): void self::assertEquals(new \DateTime('1990-09-29T12:12:53'), $dateTime); } + /** + * @requires PHP < 8.3 + */ public function testDateTimeWithTimezone(): void { $dateTime = $this->extension->dateTime('2021-09-05T15:10:00', 'America/Los_Angeles'); @@ -41,6 +47,9 @@ public function testDateTimeWithTimezone(): void self::assertEquals(new \DateTimeZone('America/Los_Angeles'), $dateTime->getTimezone()); } + /** + * @requires PHP < 8.3 + */ public function testDateTimeAD(): void { $dateTime = $this->extension->dateTimeAD('2012-04-12T19:22:23'); @@ -49,6 +58,9 @@ public function testDateTimeAD(): void self::assertEquals(new \DateTime('1166-06-01T17:43:42'), $dateTime); } + /** + * @requires PHP < 8.3 + */ public function testDateTimeBetween(): void { $dateTime = $this->extension->dateTimeBetween('1998-12-18T11:23:40', '2004-09-15T22:10:45'); @@ -63,6 +75,9 @@ public function testDateTimeBetweenShouldThrowIfFromIsNotAnteriorToUntil(): void $this->extension->dateTimeBetween('2004-09-15T22:10:45', '1998-12-18T11:23:40'); } + /** + * @requires PHP < 8.3 + */ public function testDateTimeInInterval(): void { $dateTime = $this->extension->dateTimeInInterval('1999-07-16T17:30:12', '+2 years'); @@ -120,6 +135,9 @@ public function testDateTimeThisCentury(): void self::assertLessThanOrEqual(new \DateTime('now'), $dateTime); } + /** + * @requires PHP < 8.3 + */ public function testDate(): void { $date = $this->extension->date('Y-m-d', '2102-11-12T14:45:29'); @@ -128,6 +146,9 @@ public function testDate(): void self::assertEquals('2046-12-26', $date); } + /** + * @requires PHP < 8.3 + */ public function testTime(): void { $time = $this->extension->time('H:i:s', '1978-06-27T09:43:21'); @@ -136,6 +157,9 @@ public function testTime(): void self::assertEquals('21:59:44', $time); } + /** + * @requires PHP < 8.3 + */ public function testUnixTime(): void { $unixTime = $this->extension->unixTime('1993-08-29T15:10:00'); @@ -144,6 +168,9 @@ public function testUnixTime(): void self::assertEquals(432630664, $unixTime); } + /** + * @requires PHP < 8.3 + */ public function testUnitTimeWithNumericUntil(): void { $unixTime = $this->extension->unixTime(1643830258); @@ -152,6 +179,9 @@ public function testUnitTimeWithNumericUntil(): void self::assertEquals(952499510, $unixTime); } + /** + * @requires PHP < 8.3 + */ public function testIso8601(): void { $iso8601 = $this->extension->iso8601('1993-07-11T15:10:00'); @@ -170,6 +200,9 @@ public function testAmPm(): void self::assertContains($amPm, ['am', 'pm']); } + /** + * @requires PHP < 8.3 + */ public function testDayOfMonth(): void { $dayOfMonth = $this->extension->dayOfMonth('2001-04-29T15:10:12'); @@ -178,6 +211,9 @@ public function testDayOfMonth(): void self::assertEquals('25', $dayOfMonth); } + /** + * @requires PHP < 8.3 + */ public function testDayOfWeek(): void { $dayOfWeek = $this->extension->dayOfWeek('2021-12-12T15:10:00'); @@ -186,6 +222,9 @@ public function testDayOfWeek(): void self::assertEquals('Monday', $dayOfWeek); } + /** + * @requires PHP < 8.3 + */ public function testMonth(): void { $month = $this->extension->month('2021-05-23T15:10:00'); @@ -194,6 +233,9 @@ public function testMonth(): void self::assertEquals('10', $month); } + /** + * @requires PHP < 8.3 + */ public function testMonthName(): void { $monthName = $this->extension->monthName('2021-06-06T15:10:00'); @@ -202,6 +244,9 @@ public function testMonthName(): void self::assertEquals('October', $monthName); } + /** + * @requires PHP < 8.3 + */ public function testYear(): void { $year = $this->extension->year('2021-09-12T15:10:00'); @@ -210,6 +255,9 @@ public function testYear(): void self::assertEquals('1999', $year); } + /** + * @requires PHP < 8.3 + */ public function testCentury(): void { $century = $this->extension->century(); diff --git a/test/Core/UuidTest.php b/test/Core/UuidTest.php index 9c47965c57..9836bf7c8d 100644 --- a/test/Core/UuidTest.php +++ b/test/Core/UuidTest.php @@ -17,6 +17,9 @@ public function testUuidReturnsUuid(): void self::assertTrue($this->isUuid($uuid)); } + /** + * @requires PHP < 8.3 + */ public function testUuidExpectedSeed(): void { $instance = new Uuid(new Number()); diff --git a/test/GeneratorTest.php b/test/GeneratorTest.php index 0a256e94df..41b7d15cc9 100644 --- a/test/GeneratorTest.php +++ b/test/GeneratorTest.php @@ -282,7 +282,7 @@ public function word(): string $uniqueGenerator->word(), ]; - self::assertEquals($words, $generatedWords); + self::assertEqualsCanonicalizing($words, $generatedWords); } public function testUniqueReturnsUniqueGeneratorThatThrowsWhenItCanNotGenerateUniqueValuesAnymore(): void diff --git a/test/Provider/BaseTest.php b/test/Provider/BaseTest.php index 8a2e88d94c..7fe4c6376f 100644 --- a/test/Provider/BaseTest.php +++ b/test/Provider/BaseTest.php @@ -411,6 +411,8 @@ public function testOptionalAllowsChainingProviderCallRandomlyReturnNull(): void } /** + * @requires PHP < 8.3 + * * @see https://github.com/fzaninotto/Faker/issues/265 */ public function testOptionalPercentageAndWeight(): void diff --git a/test/Provider/BiasedTest.php b/test/Provider/BiasedTest.php index 8860a4228f..bd8088c695 100644 --- a/test/Provider/BiasedTest.php +++ b/test/Provider/BiasedTest.php @@ -44,6 +44,9 @@ public function testUnbiased(): void } } + /** + * @requires PHP < 8.3 + */ public function testLinearHigh(): void { $this->performFake(['\Faker\Provider\Biased', 'linearHigh']); diff --git a/test/Provider/UuidTest.php b/test/Provider/UuidTest.php index 206bf7ef29..695df1f5c1 100644 --- a/test/Provider/UuidTest.php +++ b/test/Provider/UuidTest.php @@ -18,6 +18,9 @@ public function testUuidReturnsUuid(): void self::assertTrue($this->isUuid($uuid)); } + /** + * @requires PHP < 8.3 + */ public function testUuidExpectedSeed(): void { if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { diff --git a/test/Provider/en_GB/CompanyTest.php b/test/Provider/en_GB/CompanyTest.php index 93b5980c85..c1abbc91f5 100644 --- a/test/Provider/en_GB/CompanyTest.php +++ b/test/Provider/en_GB/CompanyTest.php @@ -28,6 +28,9 @@ public function testModulus97AlgorithmWithInvalidArgument(): void $this->faker->calculateModulus97(123); } + /** + * @requires PHP < 8.3 + */ public function testVat(): void { $this->assertDefaultVatFormat($this->faker->vat()); @@ -39,6 +42,9 @@ private function assertDefaultVatFormat($number): void self::assertEquals(1, preg_match('/^GB[\d]{3} [\d]{4} [\d]{2}$/', $number)); } + /** + * @requires PHP < 8.3 + */ public function testVatBranchType(): void { $number = $this->faker->vat(Company::VAT_TYPE_BRANCH); diff --git a/test/Provider/fi_FI/PersonTest.php b/test/Provider/fi_FI/PersonTest.php index 0c7598194d..3258142eee 100644 --- a/test/Provider/fi_FI/PersonTest.php +++ b/test/Provider/fi_FI/PersonTest.php @@ -25,6 +25,8 @@ public function provideSeedAndExpectedReturn() } /** + * @requires PHP < 8.3 + * * @dataProvider provideSeedAndExpectedReturn */ public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected): void diff --git a/test/Provider/fr_FR/AddressTest.php b/test/Provider/fr_FR/AddressTest.php index 3588fb0bf3..7c918af394 100644 --- a/test/Provider/fr_FR/AddressTest.php +++ b/test/Provider/fr_FR/AddressTest.php @@ -20,12 +20,18 @@ public function testPostcode(): void self::assertMatchesRegularExpression('@^\d{5}$@', $postcode); } + /** + * @requires PHP < 8.3 + */ public function testSecondaryAddress(): void { self::assertEquals('Étage 007', $this->faker->secondaryAddress()); self::assertEquals('Bât. 932', $this->faker->secondaryAddress()); } + /** + * @requires PHP < 8.3 + */ public function testRegion(): void { self::assertEquals('Occitanie', $this->faker->region()); diff --git a/test/Provider/fr_FR/ColorTest.php b/test/Provider/fr_FR/ColorTest.php index 453fc75601..e8ab575c60 100644 --- a/test/Provider/fr_FR/ColorTest.php +++ b/test/Provider/fr_FR/ColorTest.php @@ -12,12 +12,18 @@ */ final class ColorTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testColorName(): void { self::assertEquals('Mandarine', $this->faker->colorName()); self::assertEquals('Acajou', $this->faker->colorName()); } + /** + * @requires PHP < 8.3 + */ public function testSafeColorName(): void { self::assertEquals('bleu', $this->faker->safeColorName()); diff --git a/test/Provider/hu_HU/PersonTest.php b/test/Provider/hu_HU/PersonTest.php index d7866ecd29..459d3f2171 100644 --- a/test/Provider/hu_HU/PersonTest.php +++ b/test/Provider/hu_HU/PersonTest.php @@ -12,6 +12,9 @@ */ final class PersonTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testValidMariedFemaleLastnames(): void { self::assertEquals('Báró Vassné Zsóka', $this->faker->name('female')); diff --git a/test/Provider/ja_JP/InternetTest.php b/test/Provider/ja_JP/InternetTest.php index 3f3b6fa341..145afc6d41 100644 --- a/test/Provider/ja_JP/InternetTest.php +++ b/test/Provider/ja_JP/InternetTest.php @@ -12,11 +12,17 @@ */ final class InternetTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testUserName(): void { self::assertEquals('akira72', $this->faker->userName); } + /** + * @requires PHP < 8.3 + */ public function testDomainName(): void { self::assertEquals('nakajima.com', $this->faker->domainName); diff --git a/test/Provider/ja_JP/PersonTest.php b/test/Provider/ja_JP/PersonTest.php index 3c83cebe9a..a204326ba1 100644 --- a/test/Provider/ja_JP/PersonTest.php +++ b/test/Provider/ja_JP/PersonTest.php @@ -12,26 +12,41 @@ */ final class PersonTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testKanaNameMaleReturns(): void { self::assertEquals('アオタ ミノル', $this->faker->kanaName('male')); } + /** + * @requires PHP < 8.3 + */ public function testKanaNameFemaleReturns(): void { self::assertEquals('アオタ ミキ', $this->faker->kanaName('female')); } + /** + * @requires PHP < 8.3 + */ public function testFirstKanaNameMaleReturns(): void { self::assertEquals('ヒデキ', $this->faker->firstKanaName('male')); } + /** + * @requires PHP < 8.3 + */ public function testFirstKanaNameFemaleReturns(): void { self::assertEquals('マアヤ', $this->faker->firstKanaName('female')); } + /** + * @requires PHP < 8.3 + */ public function testLastKanaNameReturnsNakajima(): void { self::assertEquals('ナカジマ', $this->faker->lastKanaName); diff --git a/test/Provider/pl_PL/ColorTest.php b/test/Provider/pl_PL/ColorTest.php index 3c9bf1a8c7..17786de7a0 100644 --- a/test/Provider/pl_PL/ColorTest.php +++ b/test/Provider/pl_PL/ColorTest.php @@ -12,12 +12,18 @@ */ final class ColorTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testColorName(): void { self::assertEquals('mysi', $this->faker->colorName()); self::assertEquals('alabastrowy', $this->faker->colorName()); } + /** + * @requires PHP < 8.3 + */ public function testSafeColorName(): void { self::assertEquals('żółty', $this->faker->safeColorName()); diff --git a/test/Provider/sv_SE/PersonTest.php b/test/Provider/sv_SE/PersonTest.php index 08c6dae904..94952db4d7 100644 --- a/test/Provider/sv_SE/PersonTest.php +++ b/test/Provider/sv_SE/PersonTest.php @@ -25,6 +25,8 @@ public function provideSeedAndExpectedReturn() } /** + * @requires PHP < 8.3 + * * @dataProvider provideSeedAndExpectedReturn */ public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected): void diff --git a/test/Provider/uk_UA/PersonTest.php b/test/Provider/uk_UA/PersonTest.php index 8c1d39bfdb..7ad7ec9417 100644 --- a/test/Provider/uk_UA/PersonTest.php +++ b/test/Provider/uk_UA/PersonTest.php @@ -12,26 +12,41 @@ */ final class PersonTest extends TestCase { + /** + * @requires PHP < 8.3 + */ public function testFirstNameMaleReturns(): void { self::assertEquals('Максим', $this->faker->firstNameMale()); } + /** + * @requires PHP < 8.3 + */ public function testFirstNameFemaleReturns(): void { self::assertEquals('Людмила', $this->faker->firstNameFemale()); } + /** + * @requires PHP < 8.3 + */ public function testMiddleNameMaleReturns(): void { self::assertEquals('Миколайович', $this->faker->middleNameMale()); } + /** + * @requires PHP < 8.3 + */ public function testMiddleNameFemaleReturns(): void { self::assertEquals('Миколаївна', $this->faker->middleNameFemale()); } + /** + * @requires PHP < 8.3 + */ public function testLastNameReturns(): void { self::assertEquals('Броваренко', $this->faker->lastName());