phone.ru.test 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. class RUPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Russia Phone number test'),
  10. 'description' => t('Tests various valid and invalid Russia phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneRUValid() {
  15. $this->assertTrue(valid_phone_number('ru', '+7(916)9985670'), t('Test valid'));
  16. $this->assertTrue(valid_phone_number('ru', '8-912-268-5440'), t('Test valid'));
  17. $this->assertTrue(valid_phone_number('ru', '8905148-3339'), t('Test valid'));
  18. $this->assertTrue(valid_phone_number('ru', '8(913)448-51-90'), t('Test valid'));
  19. $this->assertTrue(valid_phone_number('ru', '903-345-34-34'), t('Test valid'));
  20. $this->assertTrue(valid_phone_number('ru', '903-34-334-34'), t('Test valid'));
  21. $this->assertTrue(valid_phone_number('ru', '903-34-33434'), t('Test valid '));
  22. }
  23. public function testPhoneRUInvalid() {
  24. $this->assertFalse(valid_phone_number('ru', '+33903-34-33434'), t('Test invalid '));
  25. }
  26. public function testPhoneRUFormatting() {
  27. //$this->assertEqual(format_phone_number('ru', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  28. }
  29. }