comparison core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php
2
3 namespace Drupal\Tests\locale\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6
7 /**
8 * Tests for updating the interface translations of projects.
9 *
10 * @group locale
11 */
12 class LocaleUpdateTest extends KernelTestBase {
13
14 /**
15 * {@inheritdoc}
16 */
17 protected static $modules = [
18 'locale',
19 'locale_test',
20 'system',
21 ];
22
23 /**
24 * Checks if a list of translatable projects gets build.
25 */
26 public function testUpdateProjects() {
27 $this->container->get('module_handler')->loadInclude('locale', 'compare.inc');
28
29 // Make the test modules look like a normal custom module. I.e. make the
30 // modules not hidden. locale_test_system_info_alter() modifies the project
31 // info of the locale_test and locale_test_translate modules.
32 \Drupal::state()->set('locale.test_system_info_alter', TRUE);
33
34 // Check if interface translation data is collected from hook_info.
35 $projects = locale_translation_project_list();
36 $this->assertArrayNotHasKey('locale_test_translate', $projects);
37 $this->assertEquals('core/modules/locale/test/test.%language.po', $projects['locale_test']['info']['interface translation server pattern']);
38 $this->assertEquals('locale_test', $projects['locale_test']['name']);
39 }
40
41 }