/**
* Tests widget constraint validation with composite constraints.
*/
public function testValidationWithCompositeConstraint() { // First provide a valid value, this should cause no validation.
$entity = EntityTestCompositeConstraint::
create([ 'name' => 'valid-value',
]);
$entity->
save();
$errors =
$this->
getErrorsForEntity($entity);
$this->
assertFalse(isset($errors['name'
]));
$this->
assertFalse(isset($errors['type'
]));
// Provide an invalid value for the name field.
$entity = EntityTestCompositeConstraint::
create([ 'name' => 'failure-field-name',
]);
$errors =
$this->
getErrorsForEntity($entity);
$this->
assertTrue(isset($errors['name'
]));
$this->
assertFalse(isset($errors['type'
]));