You are here

public function LocaleUpdateTest::testUpdateProjects in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/Tests/LocaleUpdateTest.php \Drupal\locale\Tests\LocaleUpdateTest::testUpdateProjects()

Checks if a list of translatable projects gets build.

File

core/modules/locale/src/Tests/LocaleUpdateTest.php, line 37
Contains \Drupal\locale\Tests\LocaleUpdateTest.

Class

LocaleUpdateTest
Tests for updating the interface translations of projects.

Namespace

Drupal\locale\Tests

Code

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.', array(
    '%key' => 'interface translation project',
  )));
}