Asserts the revision count of a certain entity.
int $expected: The expected count.
string $entity_type_id: The entity type ID, e.g. node.
int $entity_id: The entity ID.
protected function assertRevisionCount($expected, $entity_type_id, $entity_id) {
$id_field = \Drupal::entityTypeManager()
->getDefinition($entity_type_id)
->getKey('id');
$revision_count = \Drupal::entityQuery($entity_type_id)
->accessCheck(FALSE)
->condition($id_field, $entity_id)
->allRevisions()
->count()
->execute();
$this
->assertEquals($expected, $revision_count);
}