locale_translation_build_server_pattern example

// 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);

    // Confirm the project name and core value before the module is altered.     $projects = locale_translation_build_projects();
    $this->assertSame('locale_test', $projects['locale_test']->name);
    $this->assertSame('all', $projects['locale_test']->core);

    $projects['locale_test']->langcode = 'de';
    $this->assertSame('/all/locale_test/locale_test-1.2.de.po', locale_translation_build_server_pattern($projects['locale_test'], '/%core/%project/%project-%version.%language.po'));

    // Alter both the name and core value of the project.     \Drupal::state()->set('locale.test_system_info_alter_name_core', TRUE);
    drupal_static_reset('locale_translation_project_list');
    $module_list->reset();

    // Confirm the name and core value are changed in $module->info.     $module = $module_list->get('locale_test');
    $this->assertSame('locale_test_alter', $module->info['name']);
    $this->assertSame('8.6.7', $module->info['core']);
    $this->assertSame('locale_test', $module->getName());

    
Home | Imprint | This part of the site doesn't use cookies.