From f634e5af7dd97a78f3ec359085ecdd930112f65e Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Sat, 22 Jul 2023 14:58:59 +0200 Subject: [PATCH] Issue #3364204 by Sweetchuck: Locale configuration storage passes wrong arguments to install storage --- .../locale/src/LocaleDefaultConfigStorage.php | 4 +- .../Kernel/LocaleDefaultConfigStorageTest.php | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php diff --git a/core/modules/locale/src/LocaleDefaultConfigStorage.php b/core/modules/locale/src/LocaleDefaultConfigStorage.php index c99dabd0df9f..a2979d6f8723 100644 --- a/core/modules/locale/src/LocaleDefaultConfigStorage.php +++ b/core/modules/locale/src/LocaleDefaultConfigStorage.php @@ -129,8 +129,8 @@ public function listAll() { public function getComponentNames($type, array $list) { $names = array_unique( array_merge( - array_keys($this->requiredInstallStorage->getComponentNames($type, $list)), - array_keys($this->optionalInstallStorage->getComponentNames($type, $list)) + array_keys($this->requiredInstallStorage->getComponentNames($list)), + array_keys($this->optionalInstallStorage->getComponentNames($list)) ) ); if ($type == 'module' && in_array('language', $list)) { diff --git a/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php b/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php new file mode 100644 index 000000000000..f754b9b4a24d --- /dev/null +++ b/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\Tests\locale\Kernel; + +use Drupal\Core\Config\NullStorage; +use Drupal\KernelTests\KernelTestBase; +use Drupal\locale\LocaleDefaultConfigStorage; + +/** + * @group locale + */ +class LocaleDefaultConfigStorageTest extends KernelTestBase { + + protected static $modules = [ + 'language', + 'locale', + 'locale_test', + 'locale_test_translate', + ]; + + public function testGetComponentNames(): void { + $storage = new LocaleDefaultConfigStorage( + new NullStorage(), + \Drupal::languageManager(), + 'testing', + ); + + $expected = [ + 'locale_test.no_translation', + 'locale_test.translation', + 'locale_test.translation_multiple', + 'locale_test_translate.settings', + 'block.block.test_default_config', + ]; + $actual = $storage->getComponentNames( + 'module', + [ + \Drupal::moduleHandler()->getModule('locale_test'), + \Drupal::moduleHandler()->getModule('locale_test_translate'), + ], + ); + $this->assertSame($expected, $actual); + } + +} -- GitLab