function ConfigEntityMapperTest::setUp

Same name in other branches
  1. 8.9.x core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigEntityMapperTest::setUp()
  2. 10 core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigEntityMapperTest::setUp()
  3. 11.x core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigEntityMapperTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php, line 62

Class

ConfigEntityMapperTest
Tests the functionality provided by the configuration entity mapper.

Namespace

Drupal\Tests\config_translation\Unit

Code

protected function setUp() : void {
    $this->entityTypeManager = $this->createMock('Drupal\\Core\\Entity\\EntityTypeManagerInterface');
    $this->entity = $this->createMock('Drupal\\Core\\Config\\Entity\\ConfigEntityInterface');
    $this->routeProvider = $this->createMock('Drupal\\Core\\Routing\\RouteProviderInterface');
    $this->routeProvider
        ->expects($this->any())
        ->method('getRouteByName')
        ->with('entity.configurable_language.edit_form')
        ->willReturn(new Route('/admin/config/regional/language/edit/{configurable_language}'));
    $definition = [
        'class' => '\\Drupal\\config_translation\\ConfigEntityMapper',
        'base_route_name' => 'entity.configurable_language.edit_form',
        'title' => '@label language',
        'names' => [],
        'entity_type' => 'configurable_language',
        'route_name' => 'config_translation.item.overview.entity.configurable_language.edit_form',
    ];
    $typed_config_manager = $this->createMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
    $locale_config_manager = $this->getMockBuilder('Drupal\\locale\\LocaleConfigManager')
        ->disableOriginalConstructor()
        ->getMock();
    $this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $this->eventDispatcher = $this->createMock('Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface');
    $this->configEntityMapper = new ConfigEntityMapper('configurable_language', $definition, $this->getConfigFactoryStub(), $typed_config_manager, $locale_config_manager, $this->createMock('Drupal\\config_translation\\ConfigMapperManagerInterface'), $this->routeProvider, $this->getStringTranslationStub(), $this->entityTypeManager, $this->languageManager, $this->eventDispatcher);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.