function UserFieldValueTest::createUserEntity
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Kernel/UserFieldValueTest.php \Drupal\Tests\user\Kernel\UserFieldValueTest::createUserEntity()
Creates and saves a user entity for field-value tests.
2 calls to UserFieldValueTest::createUserEntity()
- UserFieldValueTest::testFastPathMatchesTypedDataOnLoadedEntity in core/
modules/ user/ tests/ src/ Kernel/ UserFieldValueTest.php - Tests that fast scalar access matches typed data without field init.
- UserFieldValueTest::testMemoryProfile in core/
modules/ user/ tests/ src/ Kernel/ UserFieldValueTest.php - Profiles memory usage of getFieldValue() vs typed data field access.
File
-
core/
modules/ user/ tests/ src/ Kernel/ UserFieldValueTest.php, line 182
Class
- UserFieldValueTest
- Tests fast scalar field access on the user entity.
Namespace
Drupal\Tests\user\KernelCode
private function createUserEntity(array $values = []) : User {
$name = $values['name'] ?? $this->randomMachineName();
$mail = $values['mail'] ?? $name . '@example.com';
$user = User::create($values + [
'name' => $name,
'mail' => $mail,
'status' => 1,
'access' => 123456789,
'timezone' => 'Europe/Berlin',
]);
$user->save();
return $user;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.