Skip to content

Commit

Permalink
Fix tests with newer versions of giggsey
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Sep 1, 2023
1 parent c94b518 commit 03009e0
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions tests/PhoneNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,49 +594,54 @@ public function testJsonSerializable(): void
}

/**
* The data provider may provide several possible results, as the results differ depending on the version of the
* underlying phonenumber library.
*
* @dataProvider providerGetDescription
*
* @param (string|null)[] $expected
*/
public function testGetDescription(string $phoneNumber, string $locale, ?string $userRegion, ?string $expected) : void
public function testGetDescription(string $phoneNumber, string $locale, ?string $userRegion, array $expected) : void
{
self::assertSame($expected, PhoneNumber::parse($phoneNumber)->getDescription($locale, $userRegion));
self::assertContains(PhoneNumber::parse($phoneNumber)->getDescription($locale, $userRegion), $expected);
}

public function providerGetDescription() : array
{
return [
['+16509036313', 'EN', null, 'Mountain View, CA'],
['+16509036313', 'EN', 'US', 'Mountain View, CA'],
['+16509036313', 'EN', 'GB', 'United States'],
['+16509036313', 'EN', 'FR', 'United States'],
['+16509036313', 'EN', 'XX', 'United States'],
['+16509036313', 'FR', null, 'Mountain View, CA'],
['+16509036313', 'FR', 'US', 'Mountain View, CA'],
['+16509036313', 'FR', 'GB', 'États-Unis'],
['+16509036313', 'FR', 'FR', 'États-Unis'],
['+16509036313', 'FR', 'XX', 'États-Unis'],

['+33381251234', 'FR', null, 'Besançon'],
['+33381251234', 'FR', 'FR', 'Besançon'],
['+33381251234', 'FR', 'US', 'France'],
['+33381251234', 'FR', 'XX', 'France'],
['+33381251234', 'EN', null, 'Besançon'],
['+33381251234', 'EN', 'FR', 'Besançon'],
['+33381251234', 'EN', 'US', 'France'],
['+33381251234', 'EN', 'XX', 'France'],

['+33328201234', 'FR', null, 'Dunkerque'],
['+33328201234', 'FR', 'FR', 'Dunkerque'],
['+33328201234', 'FR', 'US', 'France'],
['+33328201234', 'FR', 'XX', 'France'],
['+33328201234', 'GB', null, 'Dunkirk'],
['+33328201234', 'XX', null, 'Dunkirk'],

['+41229097000', 'FR', null, 'Genève'],
['+41229097000', 'FR', 'CH', 'Genève'],
['+41229097000', 'FR', 'US', 'Suisse'],
['+41229097000', 'XX', null, 'Geneva'],

['+37328000000', 'XX', null, null],
['+16509036313', 'EN', null, ['Mountain View, CA']],
['+16509036313', 'EN', 'US', ['Mountain View, CA']],
['+16509036313', 'EN', 'GB', ['United States']],
['+16509036313', 'EN', 'FR', ['United States']],
['+16509036313', 'EN', 'XX', ['United States']],
['+16509036313', 'FR', null, ['Mountain View, CA']],
['+16509036313', 'FR', 'US', ['Mountain View, CA']],
['+16509036313', 'FR', 'GB', ['États-Unis']],
['+16509036313', 'FR', 'FR', ['États-Unis']],
['+16509036313', 'FR', 'XX', ['États-Unis']],

['+33381251234', 'FR', null, ['France', 'Besançon']],
['+33381251234', 'FR', 'FR', ['France', 'Besançon']],
['+33381251234', 'FR', 'US', ['France']],
['+33381251234', 'FR', 'XX', ['France']],
['+33381251234', 'EN', null, ['France', 'Besançon']],
['+33381251234', 'EN', 'FR', ['France', 'Besançon']],
['+33381251234', 'EN', 'US', ['France']],
['+33381251234', 'EN', 'XX', ['France']],

['+33328201234', 'FR', null, ['France', 'Dunkerque']],
['+33328201234', 'FR', 'FR', ['France', 'Dunkerque']],
['+33328201234', 'FR', 'US', ['France']],
['+33328201234', 'FR', 'XX', ['France']],
['+33328201234', 'GB', null, ['Dunkirk', null]],
['+33328201234', 'XX', null, ['Dunkirk', null]],

['+41229097000', 'FR', null, ['Genève']],
['+41229097000', 'FR', 'CH', ['Genève']],
['+41229097000', 'FR', 'US', ['Suisse']],
['+41229097000', 'XX', null, ['Geneva']],

['+37328000000', 'XX', null, [null]],
];
}
}

0 comments on commit 03009e0

Please sign in to comment.