You are here

public function ConstraintViolationAssertion::assertRaised in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php, line 510

Class

ConstraintViolationAssertion
@internal

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

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::assertCount(count($expected), $violations);
  reset($violations);
  foreach ($expected as $violation) {
    \PHPUnit_Framework_Assert::assertEquals($violation, current($violations));
    next($violations);
  }
}