phone.au.test 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class AUPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Australia Phone number test'),
  10. 'description' => t('Tests various valid and invalid Australia phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneAUValid() {
  15. $this->assertTrue(valid_phone_number('au', '0200-0299'), t('ACT - 0200-0299'));
  16. $this->assertTrue(valid_phone_number('au', '2600-2639'), t('ACT - 2600-2639'));
  17. $this->assertTrue(valid_phone_number('au', '1000-1999'), t('NSW - 1000-1999'));
  18. $this->assertTrue(valid_phone_number('au', '2000-2599'), t('NSW - 2000-2599'));
  19. $this->assertTrue(valid_phone_number('au', '2640-2914'), t('NSW - 2640-2914'));
  20. $this->assertTrue(valid_phone_number('au', '0900-0999'), t('NT - 0900-0999'));
  21. $this->assertTrue(valid_phone_number('au', '0800-0899'), t('NT - 0800-0899'));
  22. $this->assertTrue(valid_phone_number('au', '9000-9999'), t('QLD - 9000-9999'));
  23. $this->assertTrue(valid_phone_number('au', '4000-4999'), t('QLD - 4000-4999'));
  24. $this->assertTrue(valid_phone_number('au', '5000-5999'), t('SA - 5000-599'));
  25. $this->assertTrue(valid_phone_number('au', '7800-7999'), t('TAS - 7800-7999'));
  26. $this->assertTrue(valid_phone_number('au', '7000-7499'), t('TAS - 7000-7499'));
  27. $this->assertTrue(valid_phone_number('au', '8000-8999'), t('VIC - 8000-8999'));
  28. $this->assertTrue(valid_phone_number('au', '3000-3999'), t('VIC - 3000-3999'));
  29. $this->assertTrue(valid_phone_number('au', '6800-6999'), t('WA - 6800-6999'));
  30. $this->assertTrue(valid_phone_number('au', '6000-6799'), t('WA - 6000-6799'));
  31. }
  32. public function testPhoneAUInvalid() {
  33. $this->assertFalse(valid_phone_number('au', '0300'), t('Test invalid - 0300'));
  34. $this->assertFalse(valid_phone_number('au', '7612'), t('Test invalid - 7612'));
  35. $this->assertFalse(valid_phone_number('au', '2915'), t('Test invalid - 2915'));
  36. $this->assertFalse(valid_phone_number('au', '2415b'), t('Test invalid - 2415b'));
  37. }
  38. public function testPhoneAUFormatting() {
  39. //$this->assertEqual(format_phone_number('au', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  40. }
  41. }