You are here

private function UnitTestBase::getNewUserMock in Select (or other) 8

Same name and namespace in other branches
  1. 4.x tests/src/Unit/UnitTestBase.php \Drupal\Tests\select_or_other\Unit\UnitTestBase::getNewUserMock()

Creates and returns a mocked user.

Return value

\PHPUnit_Framework_MockObject_MockObject The mocked user.

1 call to UnitTestBase::getNewUserMock()
UnitTestBase::addMockServicesToContainer in tests/src/Unit/UnitTestBase.php
Adds mocked services to the container.

File

tests/src/Unit/UnitTestBase.php, line 71

Class

UnitTestBase

Namespace

Drupal\Tests\select_or_other\Unit

Code

private function getNewUserMock() {
  $user_mock = $this
    ->getMockForAbstractClass('\\Drupal\\Core\\Session\\AccountProxyInterface', [
    'id',
  ]);
  $user_mock
    ->method('id')
    ->willReturn(1);
  return $user_mock;
}