diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php index 7e513b4..13b56d5 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationOverviewTest.php @@ -8,10 +8,8 @@ namespace Drupal\config_translation\Tests; use Drupal\Component\Utility\Html; -use Drupal\Core\Routing\RouteMatch; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\simpletest\WebTestBase; -use Symfony\Component\Routing\Route; /** * Translate settings and entities to various languages. @@ -176,24 +174,4 @@ public function testListingPageWithOverrides() { $this->assertNoText($overridden_label); } - /** - * Tests adding config names to mapper. - */ - public function testAddingConfigNames() { - // Get a config names mapper. - $mappers = \Drupal::service('plugin.manager.config_translation.mapper')->getMappers(); - $mapper = $mappers['system.site_information_settings']; - - // Test that it doesn't contain a config name from config_translation_test. - $config_names = $mapper->getConfigNames(); - $this->assertFalse(in_array('config_translation_test.content.test.label', $config_names)); - - // Call populateFromRouteMatch() to dispatch an event. - $mapper->populateFromRouteMatch(new RouteMatch('test', new Route('/'))); - - // Test that it now contains the new config name from config_translation_test. - $config_names = $mapper->getConfigNames(); - $this->assertTrue(in_array('config_translation_test.content.test.label', $config_names)); - } - } diff --git a/core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php b/core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php index 3f03745..a2e794f 100644 --- a/core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php +++ b/core/modules/config_translation/tests/modules/config_translation_test/src/EventSubscriber/ConfigTranslationTestSubscriber.php @@ -15,7 +15,7 @@ static function getSubscribedEvents() { public function addConfigNames(ConfigMapperEvent $event) { $mapper = $event->getMapper(); - $mapper->addConfigName('config_translation_test.content.test.label'); + $mapper->addConfigName('config_translation_test.content'); } } diff --git a/core/modules/config_translation/tests/src/Kernel/ConfigMapperTest.php b/core/modules/config_translation/tests/src/Kernel/ConfigMapperTest.php new file mode 100644 index 0000000..681ce7c --- /dev/null +++ b/core/modules/config_translation/tests/src/Kernel/ConfigMapperTest.php @@ -0,0 +1,52 @@ +getMappers(); + $mapper = $mappers['system.site_information_settings']; + + // Test that it doesn't contain a config name from config_translation_test. + $config_names = $mapper->getConfigNames(); + $this->assertFalse(in_array('config_translation_test.content', $config_names)); + + // Call populateFromRouteMatch() to dispatch an event. + $mapper->populateFromRouteMatch(new RouteMatch('test', new Route('/'))); + + // Test that it now contains the new config name from config_translation_test. + $config_names = $mapper->getConfigNames(); + $this->assertTrue(in_array('config_translation_test.content', $config_names)); + } + +}