From 0daec5301dcc13656a3d94c4143f0af71fa2fcf9 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 1 Apr 2019 23:20:06 +0100 Subject: [PATCH] Issue #3037042 by claudiu.cristea, Lendude: Convert LocaleUpdateTest::testUpdateProjects() to a kernel test --- .../tests/src/Functional/LocaleUpdateTest.php | 19 --------- .../tests/src/Kernel/LocaleUpdateTest.php | 41 +++++++++++++++++++ 2 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php index b5b71e940eb..f357075bfdc 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php @@ -26,25 +26,6 @@ class LocaleUpdateTest extends LocaleUpdateBase { $this->addLanguage('de'); } - /** - * Checks if a list of translatable projects gets build. - */ - public function testUpdateProjects() { - module_load_include('compare.inc', 'locale'); - - // Make the test modules look like a normal custom module. i.e. make the - // modules not hidden. locale_test_system_info_alter() modifies the project - // info of the locale_test and locale_test_translate modules. - \Drupal::state()->set('locale.test_system_info_alter', TRUE); - $this->resetAll(); - - // Check if interface translation data is collected from hook_info. - $projects = locale_translation_project_list(); - $this->assertFalse(isset($projects['locale_test_translate']), 'Hidden module not found'); - $this->assertEqual($projects['locale_test']['info']['interface translation server pattern'], 'core/modules/locale/test/test.%language.po', 'Interface translation parameter found in project info.'); - $this->assertEqual($projects['locale_test']['name'], 'locale_test', format_string('%key found in project info.', ['%key' => 'interface translation project'])); - } - /** * Checks if local or remote translation sources are detected. * diff --git a/core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php b/core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php new file mode 100644 index 00000000000..c7b73e0bc04 --- /dev/null +++ b/core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php @@ -0,0 +1,41 @@ +container->get('module_handler')->loadInclude('locale', 'compare.inc'); + + // Make the test modules look like a normal custom module. I.e. make the + // modules not hidden. locale_test_system_info_alter() modifies the project + // info of the locale_test and locale_test_translate modules. + \Drupal::state()->set('locale.test_system_info_alter', TRUE); + + // Check if interface translation data is collected from hook_info. + $projects = locale_translation_project_list(); + $this->assertArrayNotHasKey('locale_test_translate', $projects); + $this->assertEquals('core/modules/locale/test/test.%language.po', $projects['locale_test']['info']['interface translation server pattern']); + $this->assertEquals('locale_test', $projects['locale_test']['name']); + } + +}