You are here

protected function FractionConstraintTest::assertViolations in Fraction 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php \Drupal\Tests\fraction\Kernel\Plugin\Constraints\FractionConstraintTest::assertViolations()

Helper method to validate.

Parameters

\Drupal\Core\Entity\EntityConstraintViolationList $violations: Violation list.

1 call to FractionConstraintTest::assertViolations()
FractionConstraintTest::testConstraints in tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php
Tests constraints.

File

tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php, line 175

Class

FractionConstraintTest
Tests Constraint for Fraction.

Namespace

Drupal\Tests\fraction\Kernel\Plugin\Constraints

Code

protected function assertViolations(EntityConstraintViolationList $violations) {
  foreach ($violations as $violation) {
    $constraint = $violation
      ->getConstraint();
    if (!($constraint instanceof FractionConstraint || $constraint instanceof PrimitiveTypeConstraint)) {
      $this
        ->fail('Wrong type of constraint');
    }
  }
}