phone.es.test 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class ESPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Spain Phone number test'),
  10. 'description' => t('Tests various valid and invalid Spain phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneESValid() {
  15. $this->assertTrue(valid_phone_number('es', '972367087'), t('Test valid - 972367087'));
  16. $this->assertTrue(valid_phone_number('es', '97-3770866'), t('Test valid - 97-3770866'));
  17. $this->assertTrue(valid_phone_number('es', '972-377086'), t('Test valid - 972-377086'));
  18. }
  19. public function testPhoneESInvalid() {
  20. $this->assertFalse(valid_phone_number('es', '9988-989898'), t('Test invalid - 9988-989898'));
  21. $this->assertFalse(valid_phone_number('es', '989898988989'), t('Test invalid - 989898988989'));
  22. $this->assertFalse(valid_phone_number('es', '9 9898989898'), t('Test invalid - 9 9898989898'));
  23. }
  24. public function testPhoneESFormatting() {
  25. //$this->assertEqual(format_phone_number('es', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  26. }
  27. }