3 namespace Drupal\Tests\config_translation\Kernel;
5 use Drupal\Core\Routing\RouteMatch;
6 use Drupal\KernelTests\KernelTestBase;
7 use Symfony\Component\Routing\Route;
10 * Tests config mapper.
12 * @group config_translation
14 class ConfigMapperTest extends KernelTestBase {
19 public static $modules = [
21 'config_translation_test',
28 * Tests adding config names to mapper.
30 public function testAddingConfigNames() {
31 // Get a config names mapper.
32 $mappers = \Drupal::service('plugin.manager.config_translation.mapper')->getMappers();
33 $mapper = $mappers['system.site_information_settings'];
35 // Test that it doesn't contain a config name from config_translation_test.
36 $config_names = $mapper->getConfigNames();
37 $this->assertNotContains('config_translation_test.content', $config_names);
39 // Call populateFromRouteMatch() to dispatch the "config mapper populate"
41 $mapper->populateFromRouteMatch(new RouteMatch('test', new Route('/')));
43 // Test that it contains the new config name from config_translation_test.
44 $config_names = $mapper->getConfigNames();
45 $this->assertContains('config_translation_test.content', $config_names);