You are here

abstract class ConfigDevelTestBase in Configuration development 8

Helper class with mock objects.

Hierarchy

Expanded class hierarchy of ConfigDevelTestBase

File

tests/src/Unit/ConfigDevelTestBase.php, line 11

Namespace

Drupal\Tests\config_devel\Unit
View source
abstract class ConfigDevelTestBase extends UnitTestCase {

  /**
   * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $configFactory;

  /**
   * @var \Drupal\Core\Config\ConfigManagerInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $configManager;

  /**
   * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
   */
  protected $eventDispatcher;

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp();
    $this->configFactory = $this
      ->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
    $this->eventDispatcher = $this
      ->createMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
    $this->configManager = $this
      ->createMock('Drupal\\Core\\Config\\ConfigManagerInterface');
    $this->configManager
      ->expects($this
      ->any())
      ->method('getEntityTypeIdByName')
      ->will($this
      ->returnArgument(0));
    vfsStream::setup('public://');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigDevelTestBase::$configFactory protected property
ConfigDevelTestBase::$configManager protected property
ConfigDevelTestBase::$eventDispatcher protected property
ConfigDevelTestBase::setUp public function Overrides UnitTestCase::setUp
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.