You are here

protected function SimpleFbConnectUserManagerTest::setUp in Simple FB Connect 8.2

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

Overrides UnitTestCase::setUp

File

tests/src/Unit/SimpleFbConnectUserManagerTest.php, line 31
Contains Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectUserManagerTest.

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(array(
    'simple_fb_connect.settings' => array(
      'disable_admin_login' => 1,
      'disabled_roles' => array(
        'blocked_role' => 'blocked_role',
      ),
    ),
    'user.settings' => array(
      'register' => 'visitors',
    ),
    'system.file' => array(
      '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(array(
    '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();

  // 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);
}