Ejemplo n.º 1
0
 /**
  * @expectedException Respect\Validation\Exceptions\ValidationException
  * @expectedExceptionMessage Exception for ElseNotValid:check() method
  */
 public function testShouldThrowExceptionForTheElseRuleWhenTheIfRuleIsNotValidAndTheElseRuleIsNotOnCheckMethod()
 {
     $if = $this->getRuleMock(false);
     $then = $this->getRuleMock(false);
     $else = $this->getRuleMock(false, 'ElseNotValid');
     $rule = new When($if, $then, $else);
     $rule->check('');
 }
Ejemplo n.º 2
0
 /**
  * @expectedException Respect\Validation\Exceptions\NotEmptyException
  */
 public function testWhenException_on_else_failfast()
 {
     $v = new When(new Int(), new Between(1, 5), new NotEmpty());
     $this->assertFalse($v->check(''));
 }