$this->
assertEquals('type',
$violations[0
]->
getPropertyPath());
/** @var \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase $constraint */
$this->
assertEquals(['name', 'type'
],
$constraint->
coversFields(), 'Information about covered fields can be retrieved.'
);
} /**
* Tests the EntityChangedConstraintValidator with multiple translations.
*/
public function testEntityChangedConstraintOnConcurrentMultilingualEditing() { $this->
installEntitySchema('entity_test_mulrev_changed'
);
$storage = \Drupal::
entityTypeManager() ->
getStorage('entity_test_mulrev_changed'
);
// Create a test entity.
$entity =
$this->
createTestEntity('entity_test_mulrev_changed'
);
$entity->
save();
$entity->
setChangedTime($entity->
getChangedTime() - 1
);
$violations =
$entity->
validate();
$this->
assertEquals(1,
$violations->
count());
$this->
assertEquals('The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.',
$violations[0
]->
getMessage());