You are here

protected function GroupContentToEntityRelationshipTest::createGroup in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php \Drupal\Tests\group\Kernel\Views\GroupContentToEntityRelationshipTest::createGroup()

Creates a group.

Parameters

array $values: (optional) The values used to create the entity.

Return value

\Drupal\group\Entity\Group The created group entity.

3 calls to GroupContentToEntityRelationshipTest::createGroup()
GroupContentToEntityRelationshipTest::testAddedMemberIsListed in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
Tests that an extra group member is returned by the view.
GroupContentToEntityRelationshipTest::testGroupOwnerIsListed in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
Tests that a group's owner (default member) is returned by the view.
GroupContentToEntityRelationshipTest::testOtherContentIsNotListed in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
Tests that any other group content is not returned by the view.

File

tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php, line 83

Class

GroupContentToEntityRelationshipTest
Tests the group_content_to_entity relationship handler.

Namespace

Drupal\Tests\group\Kernel\Views

Code

protected function createGroup($values = []) {
  $group = $this->entityTypeManager
    ->getStorage('group')
    ->create($values + [
    'type' => 'default',
    'label' => $this
      ->randomMachineName(),
  ]);
  $group
    ->enforceIsNew();
  $group
    ->save();
  return $group;
}