You are here

public function PhoneFrenchTest::testPhoneFRValid in Phone 6

Same name and namespace in other branches
  1. 7 tests/phone.fr.test \PhoneFrenchTest::testPhoneFRValid()

File

tests/phone-fr.test, line 26

Class

PhoneFrenchTest
Unit tests for Phone module.

Code

public function testPhoneFRValid() {

  // test cleaning phone number
  $this
    ->assertTrue(valid_phone_number('fr', ' +33   123 45 - (67) 89'), "' +33   123 45 - (67) 89' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '+33123456789'), "'+33123456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0123456789'), "'0123456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '+33223456789'), "'+33223456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0223456789'), "'0223456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '+33323456789'), "'+33323456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0323456789'), "'0323456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '+33423456789'), "'+33423456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0423456789'), "'0423456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '+33523456789'), "'+33523456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0523456789'), "'0523456789' should be valid");

  // 06... mobile
  $this
    ->assertTrue(valid_phone_number('fr', '+33623456789'), "'+33623456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0623456789'), "'0623456789' should be valid");

  // 085... virtual private network
  $this
    ->assertTrue(valid_phone_number('fr', '+33853456789'), "'+33853456789' should be valid");
  $this
    ->assertTrue(valid_phone_number('fr', '0853456789'), "'0853456789' should be valid");

  // 087...
  // 870... 871... 872... 873... 874... 875... 877... 878... 879... assigned
  foreach (array(
    '870',
    '871',
    '872',
    '873',
    '874',
    '875',
    '877',
    '878',
    '879',
  ) as $za) {
    $this
      ->assertTrue(valid_phone_number('fr', '+33' . $za . '123456'), "'+33 {$za} 1234567' is be valid");
    $this
      ->assertTrue(valid_phone_number('fr', '0' . $za . '123456'), "'0 {$za} 1234567' is be valid");
  }
}