private function PhoneIntTest::assertConversion in Phone 7
Same name and namespace in other branches
- 6 tests/phone.int.test \PhoneIntTest::assertConversion()
11 calls to PhoneIntTest::assertConversion()
- PhoneIntTest::testAddCountryCode in tests/
phone.int.test - PhoneIntTest::testBasic in tests/
phone.int.test - PhoneIntTest::testBasicNormalizeOtherCharacters in tests/
phone.int.test - PhoneIntTest::testBasicWithFourCountryCode in tests/
phone.int.test - PhoneIntTest::testBasicWithSpaces in tests/
phone.int.test
File
- tests/
phone.int.test, line 19
Class
Code
private function assertConversion($input, $expect = TRUE, $field = array(), $expect_error = FALSE) {
$error = FALSE;
if (!isset($field['phone_int_max_length'])) {
$field['phone_int_max_length'] = '15';
}
if (!isset($field['phone_default_country_code'])) {
$field['phone_default_country_code'] = '1';
}
if ($expect === FALSE) {
$this
->assertFalse(valid_phone_number('int', $input, $field, $error));
$this
->assertIdentical($error, $expect_error);
return;
}
elseif ($expect === TRUE) {
$expect = $input;
}
$this
->assertTrue(valid_phone_number('int', $input, $field, $error));
$this
->assertIdentical($error, FALSE);
$result = format_phone_number('int', $input, $field);
$this
->assertIdentical($result, $expect);
}