// Update the revision metadata fields and the changed field, which should
// be skipped from checking for changes in
// ContentEntityBase::hasTranslationChanges().
$entity_previous_rev_id =
$entity->
getRevisionId();
// Revision metadata field revision_timestamp.
$entity->
setRevisionCreationTime(time() + 1
);
// Revision metadata field revision_uid.
$entity->
setRevisionUserId($user2->
id());
// Revision metadata field revision_log.
$entity->
setRevisionLogMessage('test'
);
// Revision metadata field revision_translation_affected.
$entity->
setRevisionTranslationAffected(TRUE
);
// Changed field.
$entity->
setChangedTime(time() + 1
);
// Check that the revision metadata fields and the changed field have been
// skipped when comparing same revisions.
$this->
assertFalse($entity->
hasTranslationChanges(), 'ContentEntityBase::hasTranslationChanges() found no changes when comparing different revisions.'
);
// Check that the revision metadata fields and the changed field have been
// skipped when comparing same revisions with enforced new revision to be
// created on save.
$entity->
setNewRevision(TRUE
);