You are here

abstract class SimpleLdapTestBase in Simple LDAP 8

Hierarchy

Expanded class hierarchy of SimpleLdapTestBase

2 files declare their use of SimpleLdapTestBase
SimpleLdapServerTest.php in tests/src/Unit/SimpleLdapServerTest.php
Contains \Drupal\Tests\simple_ldap\Unit\SimpleLdapServer
SimpleLdapUserManagerTest.php in modules/simple_ldap_user/tests/src/Unit/SimpleLdapUserManagerTest.php
Contains \Drupal\Tests\simple_ldap\Unit\SimpleLdapUserManagerTest

File

tests/src/Unit/SimpleLdapTestBase.php, line 14
Contains \Drupal\Tests\simple_ldap\Unit\SimpleLdapTestBase

Namespace

Drupal\Tests\simple_ldap\Unit
View source
abstract class SimpleLdapTestBase extends UnitTestCase {

  /**
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $config;

  /**
   * @var \Drupal\Core\Config\ConfigFactory
   */
  protected $config_factory;

  /**
   * @var string
   * Used in ::setUp. Set a default value in any inherited class.
   */
  protected $config_name;

  /**
   * {@inheritdoc}
   *
   * Sets up common service mocks for SimpleLdap unit tests.
   *
   * @param string $config_name
   */
  public function setUp() {
    parent::setUp();
    $this->config = $this
      ->getMockBuilder('\\Drupal\\Core\\Config\\ImmutableConfig')
      ->disableOriginalConstructor()
      ->getMock();
    $this->config_factory = $this
      ->getMockBuilder('\\Drupal\\Core\\Config\\ConfigFactory')
      ->disableOriginalConstructor()
      ->getMock();
    $this->config_factory
      ->expects($this
      ->once())
      ->method('get')
      ->with($this->config_name)
      ->willReturn($this->config);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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.
SimpleLdapTestBase::$config protected property
SimpleLdapTestBase::$config_factory protected property
SimpleLdapTestBase::$config_name protected property Used in ::setUp. Set a default value in any inherited class. 2
SimpleLdapTestBase::setUp public function Sets up common service mocks for SimpleLdap unit tests. Overrides UnitTestCase::setUp 2
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.