annotate core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php @ 19:fa3358dc1485 tip

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