Skip to content
Snippets Groups Projects
Unverified Commit 0daec530 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3037042 by claudiu.cristea, Lendude: Convert...

Issue #3037042 by claudiu.cristea, Lendude: Convert LocaleUpdateTest::testUpdateProjects() to a kernel test
parent 7555529a
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -26,25 +26,6 @@ protected function setUp() {
$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.
*
......
<?php
namespace Drupal\Tests\locale\Kernel;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests for updating the interface translations of projects.
*
* @group locale
*/
class LocaleUpdateTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'locale',
'locale_test',
'system',
];
/**
* Checks if a list of translatable projects gets build.
*/
public function testUpdateProjects() {
$this->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']);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment