You are here

protected function ConfigEntityMapperTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigEntityMapperTest::setUp()
  2. 9 core/modules/config_translation/tests/src/Unit/ConfigEntityMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigEntityMapperTest::setUp()

File

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

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')
    ->will($this
    ->returnValue(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);
}