You are here

public function GroupContentTest::testSubjectResaved in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/GroupContentTest.php \Drupal\Tests\group\Kernel\GroupContentTest::testSubjectResaved()

Tests that after adding an entity to a group, it gets saved again.

@covers ::postSave

See also

group_test_user_update()

File

tests/src/Kernel/GroupContentTest.php, line 73

Class

GroupContentTest
Tests for the GroupContent entity.

Namespace

Drupal\Tests\group\Kernel

Code

public function testSubjectResaved() {
  $changed = 123456789;
  $account = $this
    ->createUser([
    'changed' => $changed,
  ]);
  $group = $this
    ->createGroup();
  $group
    ->addContent($account, 'group_membership');

  // All users whose changed time was set to 123456789 get their changed time
  // set to 530496000 in group_test_user_update() when the account is updated.
  $account_unchanged = $this->entityTypeManager
    ->getStorage('user')
    ->loadUnchanged($account
    ->id());
  $this
    ->assertEquals(530496000, $account_unchanged
    ->getChangedTime(), 'Account was saved as part of being added to a group.');
}