You are here

protected function PBTKernelTestBase::createCurrentUser in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/PBTKernelTestBase.php \Drupal\Tests\permissions_by_term\Kernel\PBTKernelTestBase::createCurrentUser()
1 call to PBTKernelTestBase::createCurrentUser()
PBTKernelTestBase::setUp in tests/src/Kernel/PBTKernelTestBase.php

File

tests/src/Kernel/PBTKernelTestBase.php, line 131

Class

PBTKernelTestBase
Class PBTKernelTestBase

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

protected function createCurrentUser() {
  $testUser = User::create([
    'uid' => 2,
    'name' => 'foobar',
    'mail' => 'foobar@example.com',
  ]);
  $testUser
    ->save();
  \Drupal::service('current_user')
    ->setAccount($testUser);
}