phone.be.test 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class BEPhoneNumberTestCase extends DrupalWebTestCase {
  3. /**
  4. * Implementation of getInfo()
  5. *
  6. */
  7. public static function getInfo() {
  8. return array(
  9. 'name' => t('Belgium Phone number test'),
  10. 'description' => t('Tests various valid and invalid Belgium phone numbers for validity'),
  11. 'group' => t('Phone')
  12. );
  13. }
  14. public function testPhoneBEValid() {
  15. $this->assertTrue(valid_phone_number('be', '023456789'), '"023456789" should be valid');
  16. $this->assertTrue(valid_phone_number('be', '0478990011'), '"0478990011" should be valid');
  17. $this->assertTrue(valid_phone_number('be', '01 234 56 78'), '"01 234 56 78" should be valid');
  18. $this->assertTrue(valid_phone_number('be', '+32 12345678'), '"+32 12345678" should be valid');
  19. }
  20. public function testPhoneBEInvalid() {
  21. $this->assertFalse(valid_phone_number('be', '+323456789'), t('Test invalid'));
  22. $this->assertFalse(valid_phone_number('be', '02 345 67 89'), t('Test invalid'));
  23. }
  24. public function testPhoneBEFormatting() {
  25. //$this->assertEqual(format_phone_number('be', '+6421123456', null), '+64 21 123 456', t('Check international mobile format'));
  26. }
  27. }