resetInstance() public static method

Used for testing purposes only to reset the PhoneNumberUtil singleton to null.
public static resetInstance ( )
 public function setUp()
 {
     PhoneNumberUtil::resetInstance();
     PhoneNumberOfflineGeocoder::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance();
     $this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
 }
 public static function setUpBeforeClass()
 {
     PhoneNumberUtil::resetInstance();
     self::$AO_MOBILE1 = new PhoneNumber();
     self::$AO_MOBILE1->setCountryCode(244)->setNationalNumber(917654321);
     self::$AO_MOBILE2 = new PhoneNumber();
     self::$AO_MOBILE2->setCountryCode(244)->setNationalNumber(927654321);
     self::$AO_FIXED1 = new PhoneNumber();
     self::$AO_FIXED1->setCountryCode(244)->setNationalNumber(22254321);
     self::$AO_FIXED2 = new PhoneNumber();
     self::$AO_FIXED2->setCountryCode(244)->setNationalNumber(26254321);
     self::$AO_INVALID_NUMBER = new PhoneNumber();
     self::$AO_INVALID_NUMBER->setCountryCode(244)->setNationalNumber(101234);
     self::$UK_MOBILE1 = new PhoneNumber();
     self::$UK_MOBILE1->setCountryCode(44)->setNationalNumber(7387654321);
     self::$UK_MOBILE2 = new PhoneNumber();
     self::$UK_MOBILE2->setCountryCode(44)->setNationalNumber(7487654321);
     self::$UK_FIXED1 = new PhoneNumber();
     self::$UK_FIXED1->setCountryCode(44)->setNationalNumber(1123456789);
     self::$UK_FIXED2 = new PhoneNumber();
     self::$UK_FIXED2->setCountryCode(44)->setNationalNumber(2987654321);
     self::$UK_INVALID_NUMBER = new PhoneNumber();
     self::$UK_INVALID_NUMBER->setCountryCode(44)->setNationalNumber(7301234);
     self::$UK_PAGER = new PhoneNumber();
     self::$UK_PAGER->setCountryCode(44)->setNationalNumber(7601234567);
     self::$US_FIXED_OR_MOBILE = new PhoneNumber();
     self::$US_FIXED_OR_MOBILE->setCountryCode(1)->setNationalNumber(6502123456);
     self::$NUMBER_WITH_INVALID_COUNTRY_CODE = new PhoneNumber();
     self::$NUMBER_WITH_INVALID_COUNTRY_CODE->setCountryCode(999)->setNationalNumber(2423651234);
     self::$INTERNATIONAL_TOLL_FREE = new PhoneNumber();
     self::$INTERNATIONAL_TOLL_FREE->setCountryCode(800)->setNationalNumber(12345678);
 }
 public function setUp()
 {
     self::$plusSymbol = pack('H*', 'efbc8b');
     PhoneNumberUtil::resetInstance();
     ShortNumberInfo::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance(PhoneNumberUtilTest::TEST_META_DATA_FILE_PREFIX, CountryCodeToRegionCodeMapForTesting::$countryCodeToRegionCodeMapForTesting);
     $this->shortInfo = ShortNumberInfo::getInstance();
 }
Exemplo n.º 4
0
 public function setUp()
 {
     PhoneNumberUtil::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance();
     if (extension_loaded('intl')) {
         $this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
     }
 }
Exemplo n.º 5
0
 private function getExampleNumber($region)
 {
     $phoneUtil = PhoneNumberUtil::getInstance();
     $exampleNumber = $phoneUtil->getExampleNumber($region);
     // Reset PhoneNumberUtil just to make sure that doesn't interfere
     PhoneNumberUtil::resetInstance();
     return $exampleNumber;
 }
Exemplo n.º 6
0
 public function setUp()
 {
     if (!extension_loaded('intl')) {
         $this->markTestSkipped('The intl extension must be installed');
     }
     PhoneNumberUtil::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance();
     $this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
 }
 private static function initializePhoneUtilForTesting()
 {
     self::$bsNumber = new PhoneNumber();
     self::$bsNumber->setCountryCode(1)->setNationalNumber(2423651234);
     self::$bsMobile = new PhoneNumber();
     self::$bsMobile->setCountryCode(1)->setNationalNumber(2423591234);
     self::$internationalTollFree = new PhoneNumber();
     self::$internationalTollFree->setCountryCode(800)->setNationalNumber(12345678);
     self::$internationalTollFreeTooLong = new PhoneNumber();
     self::$internationalTollFreeTooLong->setCountryCode(800)->setNationalNumber(123456789);
     self::$universalPremiumRate = new PhoneNumber();
     self::$universalPremiumRate->setCountryCode(979)->setNationalNumber(123456789);
     self::$sgNumber = new PhoneNumber();
     self::$sgNumber->setCountryCode(65)->setNationalNumber(65218000);
     // A too-long and hence invalid US number.
     self::$usLongNumber = new PhoneNumber();
     self::$usLongNumber->setCountryCode(1)->setNationalNumber(65025300001);
     self::$usShortByOneNumber = new PhoneNumber();
     self::$usShortByOneNumber->setCountryCode(1)->setNationalNumber(650253000);
     self::$usTollFree = new PhoneNumber();
     self::$usTollFree->setCountryCode(1)->setNationalNumber(8002530000);
     self::$usNumber = new PhoneNumber();
     self::$usNumber->setCountryCode(1)->setNationalNumber(6502530000);
     self::$usLocalNumber = new PhoneNumber();
     self::$usLocalNumber->setCountryCode(1)->setNationalNumber(2530000);
     self::$nzNumber = new PhoneNumber();
     self::$nzNumber->setCountryCode(64)->setNationalNumber(33316005);
     self::$usPremium = new PhoneNumber();
     self::$usPremium->setCountryCode(1)->setNationalNumber(9002530000);
     self::$usSpoof = new PhoneNumber();
     self::$usSpoof->setCountryCode(1)->setNationalNumber(0);
     self::$usSpoofWithRawInput = new PhoneNumber();
     self::$usSpoofWithRawInput->setCountryCode(1)->setNationalNumber(0)->setRawInput("000-000-0000");
     self::$gbMobile = new PhoneNumber();
     self::$gbMobile->setCountryCode(44)->setNationalNumber(7912345678);
     self::$gbNumber = new PhoneNumber();
     self::$gbNumber->setCountryCode(44)->setNationalNumber(2070313000);
     self::$deShortNumber = new PhoneNumber();
     self::$deShortNumber->setCountryCode(49)->setNationalNumber(1234);
     self::$itMobile = new PhoneNumber();
     self::$itMobile->setCountryCode(39)->setNationalNumber(345678901);
     self::$itNumber = new PhoneNumber();
     self::$itNumber->setCountryCode(39)->setNationalNumber(236618300)->setItalianLeadingZero(true);
     self::$auNumber = new PhoneNumber();
     self::$auNumber->setCountryCode(61)->setNationalNumber(236618300);
     self::$arMobile = new PhoneNumber();
     self::$arMobile->setCountryCode(54)->setNationalNumber(91187654321);
     self::$arNumber = new PhoneNumber();
     self::$arNumber->setCountryCode(54)->setNationalNumber(1187654321);
     self::$mxMobile1 = new PhoneNumber();
     self::$mxMobile1->setCountryCode(52)->setNationalNumber(12345678900);
     self::$mxNumber1 = new PhoneNumber();
     self::$mxNumber1->setCountryCode(52)->setNationalNumber(3312345678);
     self::$mxMobile2 = new PhoneNumber();
     self::$mxMobile2->setCountryCode(52)->setNationalNumber(15512345678);
     self::$mxNumber2 = new PhoneNumber();
     self::$mxNumber2->setCountryCode(52)->setNationalNumber(8211234567);
     // Note that this is the same as the example number for DE in the metadata.
     self::$deNumber = new PhoneNumber();
     self::$deNumber->setCountryCode(49)->setNationalNumber(30123456);
     self::$jpStarNumber = new PhoneNumber();
     self::$jpStarNumber->setCountryCode(81)->setNationalNumber(2345);
     self::$alphaNumericNumber = new PhoneNumber();
     self::$alphaNumericNumber->setCountryCode(1)->setNationalNumber(80074935247);
     self::$aeUAN = new PhoneNumber();
     self::$aeUAN->setCountryCode(971)->setNationalNumber(600123456);
     self::$unknownCountryCodeNoRawInput = new PhoneNumber();
     self::$unknownCountryCodeNoRawInput->setCountryCode(2)->setNationalNumber(12345);
     PhoneNumberUtil::resetInstance();
     return PhoneNumberUtil::getInstance(self::TEST_META_DATA_FILE_PREFIX, CountryCodeToRegionCodeMapForTesting::$countryCodeToRegionCodeMapForTesting);
 }
Exemplo n.º 8
0
 public function setUp()
 {
     PhoneNumberUtil::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance();
 }
 public function supportedGlobalNetworkCallingCodes()
 {
     $returnList = array();
     PhoneNumberUtil::resetInstance();
     $phoneUtil = PhoneNumberUtil::getInstance();
     foreach ($phoneUtil->getSupportedGlobalNetworkCallingCodes() as $callingCode) {
         $returnList[] = array($callingCode);
     }
     return $returnList;
 }
Exemplo n.º 10
0
 public function testIssue64WithoutPhoneNumberUtilresetInstance()
 {
     PhoneNumberUtil::resetInstance();
     $sortNumberUtil = ShortNumberInfo::getInstance();
     $this->assertTrue($sortNumberUtil->isEmergencyNumber('999', 'GB'));
 }
 public function __construct()
 {
     PhoneNumberUtil::resetInstance();
     $this->phoneUtil = PhoneNumberUtil::getInstance(self::META_DATA_FILE_PREFIX, CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap);
 }
Exemplo n.º 12
0
 public function setUp()
 {
     PhoneNumberUtil::resetInstance();
 }
 public function setUp()
 {
     PhoneNumberUtil::resetInstance();
     $this->carrierMapper = PhoneNumberToCarrierMapper::getInstance(self::TEST_META_DATA_FILE_PREFIX);
 }