Skip to content

Commit

Permalink
Test Example Numbers for all regions
Browse files Browse the repository at this point in the history
  • Loading branch information
giggsey committed Jul 14, 2015
1 parent e4c01aa commit 76d55d3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Tests/libphonenumber/Tests/core/ExampleNumbersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use libphonenumber\Matcher;
use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil;
use libphonenumber\ShortNumberCost;
Expand Down Expand Up @@ -210,11 +211,25 @@ public function testGlobalNetworkNumbers($callingCode)

/**
* @dataProvider regionList
* @param string $regionCode
*/
public function getEveryRegionHasExampleNumber($regionCode)
public function testEveryRegionHasExampleNumber($regionCode)
{
$exampleNumber = $this->phoneNumberUtil->getExampleNumber($regionCode);
$this->assertNotNull($exampleNumber, "None found for region " . $regionCode);

/*
* Check the number is valid
*/

$e164 = $this->phoneNumberUtil->format($exampleNumber, PhoneNumberFormat::E164);

$phoneObject = $this->phoneNumberUtil->parse($e164, 'ZZ');

$this->assertEquals($phoneObject, $exampleNumber);

$this->assertTrue($this->phoneNumberUtil->isValidNumber($phoneObject));
$this->assertTrue($this->phoneNumberUtil->isValidNumberForRegion($phoneObject, $regionCode));
}

/**
Expand Down

0 comments on commit 76d55d3

Please sign in to comment.