You are here

protected function ConfigNamesMapperTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 91
Contains \Drupal\Tests\config_translation\Unit\ConfigNamesMapperTest.

Class

ConfigNamesMapperTest
Tests the functionality provided by the configuration names mapper.

Namespace

Drupal\Tests\config_translation\Unit

Code

protected function setUp() {
  $this->routeProvider = $this
    ->getMock('Drupal\\Core\\Routing\\RouteProviderInterface');
  $this->pluginDefinition = array(
    'class' => '\\Drupal\\config_translation\\ConfigNamesMapper',
    'base_route_name' => 'system.site_information_settings',
    'title' => 'System information',
    'names' => array(
      'system.site',
    ),
    'weight' => 42,
  );
  $this->typedConfigManager = $this
    ->getMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
  $this->localeConfigManager = $this
    ->getMockBuilder('Drupal\\locale\\LocaleConfigManager')
    ->disableOriginalConstructor()
    ->getMock();
  $this->configMapperManager = $this
    ->getMock('Drupal\\config_translation\\ConfigMapperManagerInterface');
  $this->urlGenerator = $this
    ->getMock('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')
    ->will($this
    ->returnValue($this->baseRoute));
  $this->languageManager = $this
    ->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
  $this->configNamesMapper = new TestConfigNamesMapper('system.site_information_settings', $this->pluginDefinition, $this
    ->getConfigFactoryStub(), $this->typedConfigManager, $this->localeConfigManager, $this->configMapperManager, $this->routeProvider, $this
    ->getStringTranslationStub(), $this->languageManager);
}