public function ConstraintViolationAssertion::assertRaised in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\ConstraintViolationAssertion::assertRaised()
File
- vendor/
symfony/ validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php, line 406
Class
- ConstraintViolationAssertion
- @internal
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function assertRaised() {
$expected = array();
foreach ($this->assertions as $assertion) {
$expected[] = $assertion
->getViolation();
}
$expected[] = $this
->getViolation();
$violations = iterator_to_array($this->context
->getViolations());
\PHPUnit_Framework_Assert::assertSame($expectedCount = count($expected), $violationsCount = count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount));
reset($violations);
foreach ($expected as $violation) {
\PHPUnit_Framework_Assert::assertEquals($violation, current($violations));
next($violations);
}
}