function UserAuthenticationTest::setUp

Overrides UnitTestCase::setUp

File

core/modules/user/tests/src/Unit/UserAuthenticationTest.php, line 71

Class

UserAuthenticationTest
Tests Drupal\user\UserAuthentication.

Namespace

Drupal\Tests\user\Unit

Code

protected function setUp() : void {
  parent::setUp();
  $this->userStorage = $this->createMock('Drupal\\Core\\Entity\\EntityStorageInterface');
  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit\Framework\MockObject\Stub $entity_type_manager */
  $entity_type_manager = $this->createStub(EntityTypeManagerInterface::class);
  $entity_type_manager->method('getStorage')
    ->with('user')
    ->willReturn($this->userStorage);
  $this->passwordService = $this->createStub(PasswordInterface::class);
  $this->userAuth = new UserAuthentication($entity_type_manager, $this->passwordService);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.