/** * @expectedException Respect\Validation\Exceptions\ValidationException * @expectedExceptionMessage Exception for ElseNotValid:assert() method */ public function testShouldThrowExceptionForTheElseRuleWhenTheIfRuleIsNotValidAndTheElseRuleIsNotOnAssertMethod() { $if = $this->getRuleMock(false); $then = $this->getRuleMock(false); $else = $this->getRuleMock(false, 'ElseNotValid'); $rule = new When($if, $then, $else); $rule->assert(''); }
/** * @expectedException Respect\Validation\Exceptions\NotEmptyException */ public function testWhenException_on_else() { $v = new When(new Int(), new Between(1, 5), new NotEmpty()); $this->assertFalse($v->assert('')); }