You are here

protected function GroupContentToEntityRelationshipTest::createUser 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::createUser()

Creates a user.

Parameters

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

Return value

\Drupal\user\Entity\User The created user entity.

4 calls to GroupContentToEntityRelationshipTest::createUser()
GroupContentToEntityRelationshipTest::setUp in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
GroupContentToEntityRelationshipTest::testAddedMemberIsListed in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
Tests that an extra group 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.
GroupContentToEntityRelationshipTest::testRegularUserIsNotListed in tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php
Tests that a regular user is not returned by the view.

File

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

Class

GroupContentToEntityRelationshipTest
Tests the group_content_to_entity relationship handler.

Namespace

Drupal\Tests\group\Kernel\Views

Code

protected function createUser($values = []) {
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->create($values + [
    'name' => $this
      ->randomMachineName(),
    'status' => 1,
  ]);
  $account
    ->enforceIsNew();
  $account
    ->save();
  return $account;
}