You are here

protected function CourierSystemTest::createUser in Courier 8

Same name and namespace in other branches
  1. 2.x courier_system/tests/src/Kernel/CourierSystemTest.php \Drupal\Tests\courier_system\Kernel\CourierSystemTest::createUser()

Create a random user for testing.

Return value

\Drupal\user\UserInterface A user entity.

2 calls to CourierSystemTest::createUser()
CourierSystemTest::testNonOverride in courier_system/tests/src/Kernel/CourierSystemTest.php
Test courier system override is off.
CourierSystemTest::testOverride in courier_system/tests/src/Kernel/CourierSystemTest.php
Test courier system override is on.

File

courier_system/tests/src/Kernel/CourierSystemTest.php, line 129

Class

CourierSystemTest
Tests Courier system.

Namespace

Drupal\Tests\courier_system\Kernel

Code

protected function createUser() {
  $mail = $this
    ->randomMachineName() . '@' . $this
    ->randomMachineName();
  $account = User::create([
    'name' => $this
      ->randomMachineName(),
    'mail' => $mail,
  ]);
  $account
    ->save();
  return $account;
}