public function GroupContentCrudHookTest::testGroupedEntityDeletion in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/GroupContentCrudHookTest.php \Drupal\Tests\group\Kernel\GroupContentCrudHookTest::testGroupedEntityDeletion()
Tests that a grouped entity deletion triggers group content deletion.
File
- tests/
src/ Kernel/ GroupContentCrudHookTest.php, line 25
Class
- GroupContentCrudHookTest
- Tests the way group content entities react to entity CRUD events.
Namespace
Drupal\Tests\group\KernelCode
public function testGroupedEntityDeletion() {
$account = $this
->createUser();
$group = $this
->createGroup([
'uid' => $account
->id(),
]);
$count = count($group
->getContent());
$account
->delete();
$this
->assertCount($count - 1, $group
->getContent(), "Deleting the group owner's account reduces the group content count by one.");
}