From 27a798a783f629a5166569447f57f9b2969b19af Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Fri, 13 Oct 2023 18:54:55 +0200 Subject: [PATCH] Migrate to PHPUnit 10 --- .gitignore | 2 +- composer.json | 2 +- phpunit.xml | 7 +++-- tests/PhoneNumberTest.php | 61 +++++++++------------------------------ 4 files changed, 20 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 4901aab..8ae88e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /vendor /composer.lock -/.phpunit.result.cache +/.phpunit.cache diff --git a/composer.json b/composer.json index 5e5d3ac..034cce4 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "giggsey/libphonenumber-for-php": "^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^10.4", "php-coveralls/php-coveralls": "^2.0", "vimeo/psalm": "5.15.0" }, diff --git a/phpunit.xml b/phpunit.xml index f150ad7..e8fb535 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,14 @@ - + tests - + + src - + diff --git a/tests/PhoneNumberTest.php b/tests/PhoneNumberTest.php index 9b63d56..2f5908d 100644 --- a/tests/PhoneNumberTest.php +++ b/tests/PhoneNumberTest.php @@ -81,10 +81,7 @@ public function testGetExampleNumber(string $regionCode, string $callingCode, ?i self::assertSame($regionCode, $phoneNumber->getRegionCode()); } - /** - * @return array - */ - public function providerGetExampleNumber() : array + public static function providerGetExampleNumber() : array { return [ ['US', '1'], @@ -112,10 +109,7 @@ public function testGetNationalNumber(string $expectedNationalNumber, string $ph self::assertSame($expectedNationalNumber, PhoneNumber::parse($phoneNumber)->getNationalNumber()); } - /** - * @return array - */ - public function providerGetNationalNumber() : array + public static function providerGetNationalNumber() : array { return [ ['6502530000', self::US_NUMBER], @@ -137,10 +131,7 @@ public function testParseNationalNumber(string $expectedNumber, string $numberTo self::assertSame($expectedNumber, (string) PhoneNumber::parse($numberToParse, $regionCode)); } - /** - * @return array - */ - public function providerParseNationalNumber() : array + public static function providerParseNationalNumber() : array { return [ // National prefix attached. @@ -184,10 +175,7 @@ public function testGetRegionCode(?string $expectedRegion, string $phoneNumber) self::assertSame($expectedRegion, PhoneNumber::parse($phoneNumber)->getRegionCode()); } - /** - * @return array - */ - public function providerGetRegionCode() : array + public static function providerGetRegionCode() : array { return [ ['BS', self::BS_NUMBER], @@ -208,10 +196,7 @@ public function testGetNumberType(int $numberType, string $phoneNumber) : void self::assertSame($numberType, PhoneNumber::parse($phoneNumber)->getNumberType()); } - /** - * @return array - */ - public function providerGetNumberType() : array + public static function providerGetNumberType() : array { return [ [PhoneNumberType::PREMIUM_RATE, self::US_PREMIUM], @@ -301,10 +286,7 @@ public function testIsNotValidNumber(string $phoneNumber) : void self::assertFalse(PhoneNumber::parse($phoneNumber)->isValidNumber()); } - /** - * @return array - */ - public function providerValidNumbers() : array + public static function providerValidNumbers() : array { return [ [self::US_NUMBER], @@ -316,10 +298,7 @@ public function providerValidNumbers() : array ]; } - /** - * @return array - */ - public function providerPossibleButNotValidNumbers() : array + public static function providerPossibleButNotValidNumbers() : array { return [ [self::US_LOCAL_NUMBER], @@ -331,10 +310,7 @@ public function providerPossibleButNotValidNumbers() : array ]; } - /** - * @return array - */ - public function providerNotPossibleNumbers() : array + public static function providerNotPossibleNumbers() : array { return [ [self::INTERNATIONAL_TOLL_FREE_TOO_LONG], @@ -354,10 +330,7 @@ public function testParseException(string $phoneNumber, ?string $regionCode = nu PhoneNumber::parse($phoneNumber, $regionCode); } - /** - * @return array - */ - public function providerParseException() : array + public static function providerParseException() : array { return [ // Empty string. @@ -411,10 +384,7 @@ public function testFormatNumber(string $expected, string $phoneNumber, int $num self::assertSame($expected, PhoneNumber::parse($phoneNumber)->format($numberFormat)); } - /** - * @return array - */ - public function providerFormatNumber() : array + public static function providerFormatNumber() : array { return [ // US @@ -520,10 +490,7 @@ public function testFormatForCallingFrom(string $phoneNumber, string $countryCod self::assertSame($expected, PhoneNumber::parse($phoneNumber)->formatForCallingFrom($countryCode)); } - /** - * @return array - */ - public function providerFormatForCallingFrom() : array + public static function providerFormatForCallingFrom() : array { return [ ['+33123456789', 'FR', '01 23 45 67 89'], @@ -551,7 +518,7 @@ public function testGetGeographicalAreaCode(string $phoneNumber, string $areaCod self::assertSame($areaCode, PhoneNumber::parse($phoneNumber)->getGeographicalAreaCode()); } - public function providerGetGeographicalAreaCode() : array + public static function providerGetGeographicalAreaCode() : array { return [ ['+442079460585', '20'], @@ -576,7 +543,7 @@ public function testIsEqualTo(string $phoneNumber1, string $phoneNumber2, bool $ self::assertSame($isEqual, $phoneNumber1->isEqualTo($phoneNumber2)); } - public function providerIsEqualTo(): array + public static function providerIsEqualTo(): array { return [ ['+442079460585', '+442079460585', true], @@ -606,7 +573,7 @@ public function testGetDescription(string $phoneNumber, string $locale, ?string self::assertContains(PhoneNumber::parse($phoneNumber)->getDescription($locale, $userRegion), $expected); } - public function providerGetDescription() : array + public static function providerGetDescription() : array { return [ ['+16509036313', 'EN', null, ['Mountain View, CA']],