function EntityKernelTestBase::createUser

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::createUser()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::createUser()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php \Drupal\KernelTests\Core\Entity\EntityKernelTestBase::createUser()

Creates a user.

Parameters

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

array $permissions: (optional) Array of permission names to assign to user.

Return value

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

40 calls to EntityKernelTestBase::createUser()
ContentEntityChangedTest::testChanged in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
Tests basic EntityChangedInterface functionality.
ContentEntityChangedTest::testRevisionChanged in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityChangedTest.php
Tests revisionable EntityChangedInterface functionality.
ContentEntityCloneTest::testClonedEntityFields in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
Tests if the entity fields are properly cloned.
ContentEntityCloneTest::testFieldEntityReferenceAfterClone in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
Tests if entity references on fields are still correct after cloning.
ContentEntityNonRevisionableFieldTest::testMulNonRevisionableField in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityNonRevisionableFieldTest.php
Tests non-revisionable fields on revisionable and translatable entities.

... See full list

File

core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php, line 114

Class

EntityKernelTestBase
Defines an abstract test base for entity kernel tests.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function createUser($values = [], $permissions = []) {
  return $this->drupalCreateUser($permissions ?: [], NULL, FALSE, $values ?: []);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.