You are here

public function GroupRevisionableUpdateTest::testRevisionData in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/Update/GroupRevisionableUpdateTest.php \Drupal\group\Tests\Functional\Update\GroupRevisionableUpdateTest::testRevisionData()

Tests that the data in the revision table is properly set.

File

tests/src/Functional/Update/GroupRevisionableUpdateTest.php, line 26

Class

GroupRevisionableUpdateTest
Tests that groups are properly made revisionable.

Namespace

Drupal\group\Tests\Functional\Update

Code

public function testRevisionData() {

  /** @var \Drupal\group\Entity\GroupInterface $group */
  $group_storage = \Drupal::entityTypeManager()
    ->getStorage('group');
  $group = $group_storage
    ->load(1);
  $group_user_id = $group
    ->getOwnerId();
  $group_created = $group
    ->getCreatedTime();
  $this
    ->runUpdates();

  // Reload the storage because the update changed it.
  $group_storage = \Drupal::entityTypeManager()
    ->getStorage('group');
  $group = $group_storage
    ->loadRevision(1);
  $this
    ->assertEquals($group_user_id, $group
    ->getRevisionUserId());
  $this
    ->assertEquals($group_created, $group
    ->getRevisionCreationTime());
  $this
    ->assertEquals('', $group
    ->getRevisionLogMessage());
}