本文整理匯總了PHP中libphonenumber\PhoneNumberUtil::loadMetadataFromFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumberUtil::loadMetadataFromFile方法的具體用法?PHP PhoneNumberUtil::loadMetadataFromFile怎麽用?PHP PhoneNumberUtil::loadMetadataFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類libphonenumber\PhoneNumberUtil
的用法示例。
在下文中一共展示了PhoneNumberUtil::loadMetadataFromFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testMissingMetadataFileThrowsRuntimeException
public function testMissingMetadataFileThrowsRuntimeException()
{
// In normal usage we should never get a state where we are asking to load metadata that doesn't
// exist. However if the library is packaged incorrectly, this could happen and the best we can
// do is make sure the exception has the file name in it.
try {
$this->phoneUtil->loadMetadataFromFile("no/such/file", "XX", -1);
$this->fail("Expected Exception");
} catch (\RuntimeException $e) {
$this->assertContains('no/such/file_XX', $e->getMessage(), "Unexpected error: " . $e->getMessage());
}
try {
$this->phoneUtil->loadMetadataFromFile("no/such/file", PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY, 123);
$this->fail("Expected Exception");
} catch (\RuntimeException $e) {
$this->assertContains('no/such/file_123', $e->getMessage(), "Unexpected error: " . $e->getMessage());
}
}