function EntityConstraintViolationListTest::testFindByCodes
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::testFindByCodes()
@covers ::findByCodes
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php, line 83
Class
- EntityConstraintViolationListTest
- @coversDefaultClass \Drupal\Core\Entity\EntityConstraintViolationList @group entity
Namespace
Drupal\Tests\Core\EntityCode
public function testFindByCodes() : void {
$account = $this->prophesize('\\Drupal\\Core\\Session\\AccountInterface')
->reveal();
$entity = $this->setupEntity($account);
$constraint_list = $this->setupConstraintListWithoutCompositeConstraint($entity);
$violations = iterator_to_array($constraint_list);
$codes = [
'test-code-violation-name',
'test-code-violation2-name',
];
$actual = $constraint_list->findByCodes($codes);
$this->assertCount(2, $actual);
$this->assertEquals(iterator_to_array($actual), [
$violations[0],
$violations[1],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.