You are here

protected function EntityKernelTestBase::createUser in Drupal 9

Same name and namespace in other branches
  1. 8 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()

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.

53 calls to EntityKernelTestBase::createUser()
CommentDefaultFormatterCacheTagsTest::setUp in core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php
CommentDefaultFormatterCacheTagsTest::testCacheTags in core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php
Tests the bubbling of cache tags.
CommentFieldAccessTest::testAccessToAdministrativeFields in core/modules/comment/tests/src/Kernel/CommentFieldAccessTest.php
Tests permissions on comment fields.
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.

... See full list

File

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

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 ?: []);
}