phone() public static method

Checks a phone number for Mexico.
public static phone ( string $check ) : boolean
$check string The value to check.
return boolean Success.
Beispiel #1
0
 /**
  * test the phone method of MxValidation
  *
  * @return void
  */
 public function testPhone()
 {
     $this->assertTrue(MxValidation::phone('1122334455'));
     $this->assertTrue(MxValidation::phone('11 22 33 44 55'));
     $this->assertTrue(MxValidation::phone('11-22-33-44-55'));
     $this->assertTrue(MxValidation::phone('22334455'));
     $this->assertTrue(MxValidation::phone('(112)233-4455'));
     $this->assertTrue(MxValidation::phone('(11)2233-4455'));
     $this->assertFalse(MxValidation::phone('112233445566'));
     $this->assertFalse(MxValidation::phone('22 33 44 55'));
     $this->assertFalse(MxValidation::phone('11-22-33-44-552'));
     $this->assertFalse(MxValidation::phone('122334455'));
     $this->assertFalse(MxValidation::phone('(112)2233-4455'));
     $this->assertFalse(MxValidation::phone('(111)2233-4455'));
 }