phone.pk.test 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class PKPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Pakistan Phone number test'),
  10. 'description' => t('Tests various valid and invalid Pakistan phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhonePKValid() {
  15. $this->assertTrue(valid_phone_number('pk', '+92 321 7469854'), t('Test valid'));
  16. $this->assertTrue(valid_phone_number('pk', '923217469857'), t('Test valid'));
  17. $this->assertTrue(valid_phone_number('pk', '041 2680226'), t('Test valid'));
  18. }
  19. public function testPhonePKInvalid() {
  20. $this->assertFalse(valid_phone_number('pk', '00124566'), t('Test invalid'));
  21. $this->assertFalse(valid_phone_number('pk', '01 922 745689'), t('Test invalid'));
  22. $this->assertFalse(valid_phone_number('pk', '0000000000'), t('Test invalid'));
  23. }
  24. public function testPhonePKFormatting() {
  25. //$this->assertEqual(format_phone_number('pk', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  26. }
  27. }