You are here

protected function RevisionableContentEntityBaseTest::createRevision in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php \Drupal\KernelTests\Core\Entity\RevisionableContentEntityBaseTest::createRevision()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php \Drupal\KernelTests\Core\Entity\RevisionableContentEntityBaseTest::createRevision()

Creates a new revision in the entity of this test class.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity where revision will be created.

\Drupal\user\UserInterface $user: The author of the new revision.

int $timestamp: The timestamp of the new revision.

string $log_message: The log message of the new revision.

1 call to RevisionableContentEntityBaseTest::createRevision()
RevisionableContentEntityBaseTest::testRevisionableContentEntity in core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
Tests the correct functionality CRUD operations of entity revisions.

File

core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php, line 199

Class

RevisionableContentEntityBaseTest
Test the revision system.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function createRevision(EntityInterface $entity, UserInterface $user, $timestamp, $log_message) {
  $entity
    ->setNewRevision(TRUE);
  $entity
    ->setRevisionCreationTime($timestamp);
  $entity
    ->setRevisionUserId($user
    ->id());
  $entity
    ->setRevisionLogMessage($log_message);
  $entity
    ->save();
}