annotate core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php @ 5:12f9dff5fda9 tip

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