You are here

protected function HierarchyNestedSetIntegrationTest::getEntityRevisionId in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/HierarchyNestedSetIntegrationTest.php \Drupal\Tests\entity_hierarchy\Kernel\HierarchyNestedSetIntegrationTest::getEntityRevisionId()

Gets the revision ID for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity revision ID if it exists, otherwise entity ID.

Return value

int Revision ID.

2 calls to HierarchyNestedSetIntegrationTest::getEntityRevisionId()
HierarchyNestedSetIntegrationTest::assertParentWithTwoChildren in tests/src/Kernel/HierarchyNestedSetIntegrationTest.php
Test parent/child relationship.
HierarchyNestedSetIntegrationTest::assertSimpleParentChild in tests/src/Kernel/HierarchyNestedSetIntegrationTest.php
Test parent/child relationship.

File

tests/src/Kernel/HierarchyNestedSetIntegrationTest.php, line 361

Class

HierarchyNestedSetIntegrationTest
Tests integration with entity_hierarchy.

Namespace

Drupal\Tests\entity_hierarchy\Kernel

Code

protected function getEntityRevisionId(EntityInterface $entity) {
  $id = $entity
    ->id();
  if (!($revision_id = $entity
    ->getRevisionId())) {
    $revision_id = $id;
  }
  return $revision_id;
}