Пример #1
0
 /**
  * Returns the last constraint which did not match.
  * @return null|\Brickoo\Component\Validation\Constraint\Constraint otherwise null
  */
 public function getFailedConstraint()
 {
     return $this->constraintGroup->getFailedConstraint();
 }
Пример #2
0
 /**
  * @covers Brickoo\Component\Validation\Constraint\AndOrConstraint::matches
  * @covers Brickoo\Component\Validation\Constraint\AndOrConstraint::removeFailures
  */
 public function testRemoveFailures()
 {
     $andOrConstraint = new AndOrConstraint([$constraint = new IsInternalTypeConstraint("string")]);
     $this->assertFalse($andOrConstraint->matches(12345));
     $this->assertSame($constraint, $andOrConstraint->getFailedConstraint());
     $this->assertTrue($andOrConstraint->matches("success"));
     $this->assertNull($andOrConstraint->getFailedConstraint());
 }