You are here

protected function UserAuthTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/tests/src/Unit/UserAuthTest.php \Drupal\Tests\user\Unit\UserAuthTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/user/tests/src/Unit/UserAuthTest.php, line 64
Contains \Drupal\Tests\user\Unit\UserAuthTest.

Class

UserAuthTest
@coversDefaultClass \Drupal\user\UserAuth @group user

Namespace

Drupal\Tests\user\Unit

Code

protected function setUp() {
  $this->userStorage = $this
    ->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
  $entity_manager = $this
    ->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
  $entity_manager
    ->expects($this
    ->any())
    ->method('getStorage')
    ->with('user')
    ->will($this
    ->returnValue($this->userStorage));
  $this->passwordService = $this
    ->getMock('Drupal\\Core\\Password\\PasswordInterface');
  $this->testUser = $this
    ->getMockBuilder('Drupal\\user\\Entity\\User')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'id',
    'setPassword',
    'save',
    'getPassword',
  ))
    ->getMock();
  $this->userAuth = new UserAuth($entity_manager, $this->passwordService);
}