function ConfigNamesMapperTest::setUp
Same name in other branches
- 9 core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest::setUp()
- 8.9.x core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest::setUp()
- 11.x core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
modules/ config_translation/ tests/ src/ Unit/ ConfigNamesMapperTest.php, line 98
Class
- ConfigNamesMapperTest
- Tests the functionality provided by the configuration names mapper.
Namespace
Drupal\Tests\config_translation\UnitCode
protected function setUp() : void {
parent::setUp();
$this->routeProvider = $this->createMock('Drupal\\Core\\Routing\\RouteProviderInterface');
$this->pluginDefinition = [
'class' => '\\Drupal\\config_translation\\ConfigNamesMapper',
'base_route_name' => 'system.site_information_settings',
'title' => 'System information',
'names' => [
'system.site',
],
'weight' => 42,
];
$this->typedConfigManager = $this->createMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
$this->localeConfigManager = $this->getMockBuilder('Drupal\\locale\\LocaleConfigManager')
->disableOriginalConstructor()
->getMock();
$this->configMapperManager = $this->createMock('Drupal\\config_translation\\ConfigMapperManagerInterface');
$this->urlGenerator = $this->createMock('Drupal\\Core\\Routing\\UrlGeneratorInterface');
$container = new ContainerBuilder();
$container->set('url_generator', $this->urlGenerator);
\Drupal::setContainer($container);
$this->baseRoute = new Route('/admin/config/system/site-information');
$this->routeProvider
->expects($this->any())
->method('getRouteByName')
->with('system.site_information_settings')
->willReturn($this->baseRoute);
$this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$this->eventDispatcher = $this->createMock('Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface');
$this->configNamesMapper = new TestConfigNamesMapper('system.site_information_settings', $this->pluginDefinition, $this->getConfigFactoryStub(), $this->typedConfigManager, $this->localeConfigManager, $this->configMapperManager, $this->routeProvider, $this->getStringTranslationStub(), $this->languageManager, $this->eventDispatcher);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.