class EntityConstraintViolationListTest extends UnitTestCase
{ /**
* @covers ::filterByFields
*/
public function testFilterByFields() { $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
]]);
} /**
* @covers ::filterByFields
*/
public function testFilterByFieldsWithCompositeConstraints() {