You are here

public function PhoneFrenchTest::testPhoneFRFormatting in Phone 7

Same name and namespace in other branches
  1. 6 tests/phone-fr.test \PhoneFrenchTest::testPhoneFRFormatting()

File

tests/phone.fr.test, line 102

Class

PhoneFrenchTest
Unit tests for Phone module.

Code

public function testPhoneFRFormatting() {

  // test cleaning phone number
  $this
    ->assertEqual(format_fr_phone_number('+33 123456789a'), '+33 123456789a', "'+33 123456789a', not valid so just ouptut without formatting");
  $this
    ->assertEqual(format_fr_phone_number('01234567a8'), '01234567a8', "'01234567a8', not valid so just ouptut without formatting");
  $this
    ->assertEqual(format_fr_phone_number('+33 123456789'), '0123456789', "international --> national");
  $this
    ->assertEqual(format_fr_phone_number(' +33   123 45 - (67) 89'), '0123456789', "international --> national");
  $add_country_code = array(
    'phone_country_code' => TRUE,
  );
  $this
    ->assertEqual(format_fr_phone_number('+33 123456789', $add_country_code), '+33 123456789', "international --> international");
  $this
    ->assertEqual(format_fr_phone_number(' +33   123 45 - (67) 89', $add_country_code), '+33 123456789', "international --> international");
}