You are here

protected function SimpleFbConnectUserManagerTest::setUp in Simple FB Connect 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/SimpleFbConnectUserManagerTest.php \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectUserManagerTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/SimpleFbConnectUserManagerTest.php, line 27

Class

SimpleFbConnectUserManagerTest
@coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectUserManager @group simple_fb_connect

Namespace

Drupal\Tests\simple_fb_connect\Unit

Code

protected function setUp() {
  parent::setUp();
  $this->configFactory = $this
    ->getConfigFactoryStub([
    'simple_fb_connect.settings' => [
      'disable_admin_login' => 1,
      'disabled_roles' => [
        'blocked_role' => 'blocked_role',
      ],
    ],
    'user.settings' => [
      'register' => 'visitors',
    ],
    'system.file' => [
      'default_scheme' => 'public',
    ],
  ]);
  $this->loggerFactory = $this
    ->getMock('Drupal\\Core\\Logger\\LoggerChannelFactoryInterface');
  $this->stringTranslation = $this
    ->getMock('Drupal\\Core\\StringTranslation\\TranslationInterface');
  $this->eventDispatcher = $this
    ->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
  $this->entityTypeManager = $this
    ->getMockBuilder('Drupal\\Core\\Entity\\EntityTypeManagerInterface')
    ->setMethods([
    'load',
  ])
    ->getMockForAbstractClass();
  $this->entityFieldManager = $this
    ->getMockBuilder('Drupal\\Core\\Entity\\EntityFieldManagerInterface')
    ->getMock();
  $this->token = $this
    ->getMockBuilder('Drupal\\Core\\Utility\\Token')
    ->disableOriginalConstructor()
    ->getMock();
  $this->transliteration = $this
    ->getMockBuilder('Drupal\\Core\\Transliteration\\PhpTransliteration')
    ->disableOriginalConstructor()
    ->getMock();
  $this->languageManager = $this
    ->getMockBuilder('Drupal\\Core\\Language\\LanguageManagerInterface')
    ->getMock();

  // Note that we are creating an instance of TestSimpleFbConnectUserManager
  // instead of SimpleFbConnectUserManager. The test class overriders the
  // wrapper methods that call procedural Drupal functions.
  $this->userManager = new TestSimpleFbConnectUserManager($this->configFactory, $this->loggerFactory, $this->stringTranslation, $this->eventDispatcher, $this->entityTypeManager, $this->entityFieldManager, $this->token, $this->transliteration, $this->languageManager);
}