You are here

public function GroupContentStorageTest::testCreateForInvalidBundle in Group 8

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

Tests the creation of a GroupContent entity using an incorrect bundle.

@covers ::createForEntityInGroup

File

tests/src/Kernel/GroupContentStorageTest.php, line 124

Class

GroupContentStorageTest
Tests the behavior of group content storage handler.

Namespace

Drupal\Tests\group\Kernel

Code

public function testCreateForInvalidBundle() {
  $group = $this
    ->createGroup();
  $subgroup = $this
    ->createGroup([
    'type' => 'other',
  ]);
  $this
    ->expectException(EntityStorageException::class);
  $this
    ->expectExceptionMessage("The provided plugin provided does not support the entity's bundle.");
  $this->storage
    ->createForEntityInGroup($subgroup, $group, 'group_as_content');
}