Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConstraintValidatorTestCase.php

function ConstraintViolationAssertion::assertRaised

File

vendor/symfony/validator/Test/ConstraintValidatorTestCase.php, line 406

Class

ConstraintViolationAssertion

Namespace

Symfony\Component\Validator\Test

Code

public function assertRaised() : void {
    $expected = [];
    foreach ($this->assertions as $assertion) {
        $expected[] = $assertion->getViolation();
    }
    $expected[] = $this->getViolation();
    $violations = iterator_to_array($this->context
        ->getViolations());
    Assert::assertSame($expectedCount = \count($expected), $violationsCount = \count($violations), \sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount));
    reset($violations);
    foreach ($expected as $violation) {
        Assert::assertEquals($violation, current($violations));
        next($violations);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal