You are here

public function ConfigNamesMapperTest::testGetConfigData in Drupal 9

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

Tests ConfigNamesMapper::getConfigData().

File

core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php, line 461
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

public function testGetConfigData() {
  $configs = [
    'system.site' => [
      'name' => 'Drupal',
      'slogan' => 'Come for the software, stay for the community!',
    ],
    'system.maintenance' => [
      'enabled' => FALSE,
      'message' => '@site is currently under maintenance.',
    ],
    'system.rss' => [
      'items' => [
        'view_mode' => 'rss',
      ],
    ],
  ];
  $this->configNamesMapper
    ->setConfigNames(array_keys($configs));
  $config_factory = $this
    ->getConfigFactoryStub($configs);
  $this->configNamesMapper
    ->setConfigFactory($config_factory);
  $result = $this->configNamesMapper
    ->getConfigData();
  $this
    ->assertSame($configs, $result);
}