function EntityConstraintViolationListTest::setupConstraintListWithoutCompositeConstraint
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::setupConstraintListWithoutCompositeConstraint()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::setupConstraintListWithoutCompositeConstraint()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::setupConstraintListWithoutCompositeConstraint()
Builds an entity constraint violation list without composite constraints.
Parameters
\Drupal\Core\Entity\FieldableEntityInterface $entity: A fieldable entity.
Return value
\Drupal\Core\Entity\EntityConstraintViolationList The entity constraint violation list.
3 calls to EntityConstraintViolationListTest::setupConstraintListWithoutCompositeConstraint()
- EntityConstraintViolationListTest::testFilterByFieldAccess in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFieldAccess
- EntityConstraintViolationListTest::testFilterByFields in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::filterByFields
- EntityConstraintViolationListTest::testFindByCodes in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php - @covers ::findByCodes
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php, line 138
Class
- EntityConstraintViolationListTest
- @coversDefaultClass \Drupal\Core\Entity\EntityConstraintViolationList @group entity
Namespace
Drupal\Tests\Core\EntityCode
protected function setupConstraintListWithoutCompositeConstraint(FieldableEntityInterface $entity) {
$violations = [];
// Add two violations to two specific fields.
$violations[] = new ConstraintViolation('test name violation', '', [], '', 'name', 'invalid', NULL, 'test-code-violation-name');
$violations[] = new ConstraintViolation('test name violation2', '', [], '', 'name', 'invalid', NULL, 'test-code-violation2-name');
$violations[] = new ConstraintViolation('test type violation', '', [], '', 'type', 'invalid', NULL, 'test-code-violation-type');
$violations[] = new ConstraintViolation('test type violation2', '', [], '', 'type', 'invalid', NULL, 'test-code-violation2-type');
// Add two entity level specific violations.
$violations[] = new ConstraintViolation('test entity violation', '', [], '', '', 'invalid');
$violations[] = new ConstraintViolation('test entity violation2', '', [], '', '', 'invalid');
return new EntityConstraintViolationList($entity, $violations);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.