phone.hu.test 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. class HUPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Hungary Phone number test'),
  10. 'description' => t('Tests various valid and invalid Hungary phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneHUValid() {
  15. $this->assertTrue(valid_phone_number('hu', '+3611234567'), t('Test valid'));
  16. $this->assertTrue(valid_phone_number('hu', '+3676123456'), t('Test valid'));
  17. $this->assertTrue(valid_phone_number('hu', '+36301234567'), t('Test valid'));
  18. $this->assertTrue(valid_phone_number('hu', '+36 1 1234567'), t('Test valid'));
  19. $this->assertTrue(valid_phone_number('hu', '+36 76 123456'), t('Test valid'));
  20. $this->assertTrue(valid_phone_number('hu', '+36 30 1234567'), t('Test valid'));
  21. $this->assertTrue(valid_phone_number('hu', '+36(1)1234567'), t('Test valid'));
  22. $this->assertTrue(valid_phone_number('hu', '+36(76)123456'), t('Test valid'));
  23. $this->assertTrue(valid_phone_number('hu', '+36(30)1234567'), t('Test valid'));
  24. $this->assertTrue(valid_phone_number('hu', '1/123-4567'), t('Test valid'));
  25. $this->assertTrue(valid_phone_number('hu', '76/123-456'), t('Test valid'));
  26. $this->assertTrue(valid_phone_number('hu', '30/123-45-67'), t('Test valid'));
  27. }
  28. public function testPhoneHUInvalid() {
  29. $this->assertFalse(valid_phone_number('hu', '+0011234567'), t('Test invalid'));
  30. }
  31. public function testPhoneHUFormatting() {
  32. //$this->assertEqual(format_phone_number('hu', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  33. }
  34. }