public function GroupContentStorageTest::testCreateForUnsavedEntity in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Kernel/GroupContentStorageTest.php \Drupal\Tests\group\Kernel\GroupContentStorageTest::testCreateForUnsavedEntity()
Tests the creation of a GroupContent entity using an unsaved entity.
@covers ::createForEntityInGroup
File
- tests/
src/ Kernel/ GroupContentStorageTest.php, line 96
Class
- GroupContentStorageTest
- Tests the behavior of group content storage handler.
Namespace
Drupal\Tests\group\KernelCode
public function testCreateForUnsavedEntity() {
$group = $this
->createGroup();
$account = $this
->createUnsavedUser();
$this
->expectException(EntityStorageException::class);
$this
->expectExceptionMessage('Cannot add an unsaved entity to a group.');
$this->storage
->createForEntityInGroup($account, $group, 'user_as_content');
}