You are here

class DrupalUserProcessorTests in Lightweight Directory Access Protocol (LDAP) 8.3

Tests for the DrupalUserProcessor.

@coversDefaultClass \Drupal\ldap_user\Processor\DrupalUserProcessor @group ldap

Hierarchy

Expanded class hierarchy of DrupalUserProcessorTests

File

ldap_user/tests/src/Unit/DrupalUserProcessorTests.php, line 15

Namespace

Drupal\Tests\ldap_user\Unit
View source
class DrupalUserProcessorTests extends UnitTestCase implements LdapUserAttributesInterface {
  public $cacheFactory;
  public $configFactory;
  public $serverFactory;
  public $config;
  public $container;
  public $provisioningEvents;

  /**
   * Test setup.
   */
  protected function setUp() {
    parent::setUp();
    $this->provisioningEvents = [
      self::PROVISION_TO_DRUPAL => [
        self::EVENT_SYNC_TO_DRUPAL_USER,
        self::EVENT_SYNC_TO_DRUPAL_USER,
      ],
      self::PROVISION_TO_LDAP => [
        self::EVENT_SYNC_TO_LDAP_ENTRY,
        self::EVENT_CREATE_LDAP_ENTRY,
      ],
    ];
    $this->config = $this
      ->getMockBuilder('\\Drupal\\Core\\Config\\ImmutableConfig')
      ->disableOriginalConstructor()
      ->getMock();
    $this->configFactory = $this
      ->getMockBuilder('\\Drupal\\Core\\Config\\ConfigFactory')
      ->disableOriginalConstructor()
      ->getMock();
    $this->configFactory
      ->expects($this
      ->any())
      ->method('get')
      ->with('ldap_user.settings')
      ->willReturn($this->config);
    $this->cacheFactory = $this
      ->getMockBuilder('\\Drupal\\Core\\Cache\\CacheFactory')
      ->disableOriginalConstructor()
      ->getMock();
    $this->cacheFactory
      ->expects($this
      ->any())
      ->method('get')
      ->willReturn(FALSE);
    $this->detailLog = $this
      ->getMockBuilder('\\Drupal\\ldap_servers\\Logger\\LdapDetailLog')
      ->disableOriginalConstructor()
      ->getMock();
    $this->container = new ContainerBuilder();
    $this->container
      ->set('config.factory', $this->configFactory);
    $this->container
      ->set('cache.default', $this->cacheFactory);
    $this->container
      ->set('ldap.detail_log', $this->detailLog);
    \Drupal::setContainer($this->container);
  }

  /**
   * Placeholder test.
   */
  public function testBase() {
    $this
      ->assertTrue(TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalUserProcessorTests::$cacheFactory public property
DrupalUserProcessorTests::$config public property
DrupalUserProcessorTests::$configFactory public property
DrupalUserProcessorTests::$container public property
DrupalUserProcessorTests::$provisioningEvents public property
DrupalUserProcessorTests::$serverFactory public property
DrupalUserProcessorTests::setUp protected function Test setup. Overrides UnitTestCase::setUp
DrupalUserProcessorTests::testBase public function Placeholder test.
LdapUserAttributesInterface::ACCOUNT_CREATION_LDAP_BEHAVIOUR constant
LdapUserAttributesInterface::ACCOUNT_CREATION_USER_SETTINGS_FOR_LDAP constant
LdapUserAttributesInterface::EVENT_CREATE_DRUPAL_USER constant
LdapUserAttributesInterface::EVENT_CREATE_LDAP_ENTRY constant
LdapUserAttributesInterface::EVENT_LDAP_ASSOCIATE_DRUPAL_USER constant
LdapUserAttributesInterface::EVENT_SYNC_TO_DRUPAL_USER constant
LdapUserAttributesInterface::EVENT_SYNC_TO_LDAP_ENTRY constant
LdapUserAttributesInterface::MANUAL_ACCOUNT_CONFLICT_LDAP_ASSOCIATE constant
LdapUserAttributesInterface::MANUAL_ACCOUNT_CONFLICT_NO_LDAP_ASSOCIATE constant
LdapUserAttributesInterface::MANUAL_ACCOUNT_CONFLICT_REJECT constant
LdapUserAttributesInterface::MANUAL_ACCOUNT_CONFLICT_SHOW_OPTION_ON_FORM constant
LdapUserAttributesInterface::PROVISION_DRUPAL_USER_ON_USER_AUTHENTICATION constant
LdapUserAttributesInterface::PROVISION_DRUPAL_USER_ON_USER_ON_MANUAL_CREATION constant
LdapUserAttributesInterface::PROVISION_DRUPAL_USER_ON_USER_UPDATE_CREATE constant
LdapUserAttributesInterface::PROVISION_LDAP_ENTRY_ON_USER_ON_USER_AUTHENTICATION constant
LdapUserAttributesInterface::PROVISION_LDAP_ENTRY_ON_USER_ON_USER_DELETE constant
LdapUserAttributesInterface::PROVISION_LDAP_ENTRY_ON_USER_ON_USER_UPDATE_CREATE constant
LdapUserAttributesInterface::PROVISION_TO_ALL constant
LdapUserAttributesInterface::PROVISION_TO_DRUPAL constant
LdapUserAttributesInterface::PROVISION_TO_LDAP constant
LdapUserAttributesInterface::PROVISION_TO_NONE constant
LdapUserAttributesInterface::USER_CONFLICT_ATTEMPT_RESOLVE constant
LdapUserAttributesInterface::USER_CONFLICT_LOG constant
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.