function EntityConstraintViolationListTest::testFilterByFields
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::testFilterByFields()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::testFilterByFields()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityConstraintViolationListTest.php \Drupal\Tests\Core\Entity\EntityConstraintViolationListTest::testFilterByFields()
@covers ::filterByFields
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityConstraintViolationListTest.php, line 23
Class
- EntityConstraintViolationListTest
- @coversDefaultClass \Drupal\Core\Entity\EntityConstraintViolationList @group entity
Namespace
Drupal\Tests\Core\EntityCode
public function testFilterByFields() : void {
$account = $this->prophesize('\\Drupal\\Core\\Session\\AccountInterface')
->reveal();
$entity = $this->setupEntity($account);
$constraint_list = $this->setupConstraintListWithoutCompositeConstraint($entity);
$violations = iterator_to_array($constraint_list);
$this->assertSame($constraint_list->filterByFields([
'name',
]), $constraint_list);
$this->assertCount(4, $constraint_list);
$this->assertEquals(array_values(iterator_to_array($constraint_list)), [
$violations[2],
$violations[3],
$violations[4],
$violations[5],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.