/** * test pass through failure on postal * * @expectedException PHPUnit_Framework_Error * @return void */ public function testPassThroughMethodFailure() { Validation::phone('text', null, __NAMESPACE__ . '\\TestNlValidation'); }
/** * testPhone method * * @return void */ public function testPhone() { $this->assertFalse(Validation::phone('teststring')); $this->assertFalse(Validation::phone('1-(33)-(333)-(4444)')); $this->assertFalse(Validation::phone('1-(33)-3333-4444')); $this->assertFalse(Validation::phone('1-(33)-33-4444')); $this->assertFalse(Validation::phone('1-(33)-3-44444')); $this->assertFalse(Validation::phone('1-(33)-3-444')); $this->assertFalse(Validation::phone('1-(33)-3-44')); $this->assertFalse(Validation::phone('(055) 999-9999')); $this->assertFalse(Validation::phone('(155) 999-9999')); $this->assertFalse(Validation::phone('(595) 999-9999')); $this->assertFalse(Validation::phone('(213) 099-9999')); $this->assertFalse(Validation::phone('(213) 199-9999')); // invalid area-codes $this->assertFalse(Validation::phone('1-(511)-999-9999')); $this->assertFalse(Validation::phone('1-(555)-999-9999')); // invalid exhange $this->assertFalse(Validation::phone('1-(222)-511-9999')); // invalid phone number $this->assertFalse(Validation::phone('1-(222)-555-0199')); $this->assertFalse(Validation::phone('1-(222)-555-0122')); // valid phone numbers $this->assertTrue(Validation::phone('416-428-1234')); $this->assertTrue(Validation::phone('1-(369)-333-4444')); $this->assertTrue(Validation::phone('1-(973)-333-4444')); $this->assertTrue(Validation::phone('1-(313)-555-9999')); $this->assertTrue(Validation::phone('1-(222)-555-0299')); $this->assertTrue(Validation::phone('508-428-1234')); $this->assertTrue(Validation::phone('1-(508)-232-9651')); $this->assertTrue(Validation::phone('1 (222) 333 4444')); $this->assertTrue(Validation::phone('+1 (222) 333 4444')); $this->assertTrue(Validation::phone('(222) 333 4444')); $this->assertTrue(Validation::phone('1-(333)-333-4444')); $this->assertTrue(Validation::phone('1.(333)-333-4444')); $this->assertTrue(Validation::phone('1.(333).333-4444')); $this->assertTrue(Validation::phone('1.(333).333.4444')); $this->assertTrue(Validation::phone('1-333-333-4444')); }