You are here

public function OgMembershipTest::testNoOwnerException in Organic groups 8

Test that it is possible to create groups without an owner.

@todo This test is not related to the OgMembership entity. It should be moved to a more appropriate test class.

File

tests/src/Kernel/Entity/OgMembershipTest.php, line 261

Class

OgMembershipTest
Tests the OgMembership entity.

Namespace

Drupal\Tests\og\Kernel\Entity

Code

public function testNoOwnerException() {

  // Create a bundle and add as a group.
  $bundle = mb_strtolower($this
    ->randomMachineName());
  $group = NodeType::create([
    'type' => $bundle,
    'label' => $this
      ->randomString(),
  ]);
  $group
    ->save();

  // Add that as a group.
  $this->groupTypeManager
    ->addGroup('node', $bundle);
  $entity = Node::create([
    'title' => $this
      ->randomString(),
    'type' => $bundle,
  ]);
  $entity
    ->save();
}