phone.ca.test 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class CAPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Canada & US Phone number test'),
  10. 'description' => t('Tests various valid and invalid Canada & US phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneCAValid() {
  15. $this->assertTrue(valid_phone_number('ca', '1-800-555-1212'), t('Test valid - 1-800-555-1212'));
  16. $this->assertTrue(valid_phone_number('ca', '800-555-1212'), t('Test valid - 800-555-1212'));
  17. $this->assertTrue(valid_phone_number('ca', '(201)223-4567'), t('Test valid - (201)223-4567'));
  18. $this->assertTrue(valid_phone_number('ca', '604 543 9245'), t('Test valid - British Columbia 604 543 9245'));
  19. }
  20. public function testPhoneCAInvalid() {
  21. //$this->assertFalse(valid_phone_number('ca', '021 3012 3456'), t('Test invalid '));
  22. }
  23. public function testPhoneCAFormatting() {
  24. //$this->assertEqual(format_phone_number('ca', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  25. }
  26. }