LocaleUpdateTest.php

Same filename in this branch
  1. 10 core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Same filename in other branches
  1. 9 core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php
  2. 9 core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
  3. 8.9.x core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php
  4. 8.9.x core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
  5. 11.x core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php
  6. 11.x core/modules/locale/tests/src/Functional/LocaleUpdateTest.php

Namespace

Drupal\Tests\locale\Kernel

File

core/modules/locale/tests/src/Kernel/LocaleUpdateTest.php

View source
<?php

declare (strict_types=1);
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() : void {
        $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']);
    }

}

Classes

Title Deprecated Summary
LocaleUpdateTest Tests for updating the interface translations of projects.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.