function LocaleBatchTest::testEnglishTranslationSkipsDefaultPattern
Tests English translations skip default drupal.org pattern.
File
-
core/
modules/ locale/ tests/ src/ Kernel/ LocaleBatchTest.php, line 53
Class
- LocaleBatchTest
- Tests locale batches.
Namespace
Drupal\Tests\locale\KernelCode
public function testEnglishTranslationSkipsDefaultPattern() : void {
$this->installConfig([
'locale',
'language',
]);
$this->installSchema('locale', [
'locales_source',
'locales_target',
'locale_file',
]);
$this->container
->get('module_handler')
->loadInclude('locale', 'batch.inc');
// Create source matching default drupal.org pattern.
$source = (object) [
'name' => 'test_module',
'langcode' => 'en',
'project' => 'test_module',
'version' => '1.0.0',
'core' => 'all',
'files' => [
LOCALE_TRANSLATION_REMOTE => (object) [
'uri' => 'https://ftp.drupal.org/files/translations/all/test_module/test_module-1.0.0.en.po',
],
],
];
\Drupal::keyValue('locale.translation_status')->setMultiple([
'test_module' => [
'en' => $source,
],
]);
$context = [
'results' => [],
];
locale_translation_batch_status_check('test_module', 'en', [
'use_remote' => TRUE,
'finish_feedback' => TRUE,
], $context);
// Should be marked as failed (skipped) for English default pattern.
$this->assertContains('test_module', $context['results']['failed_files']);
$this->assertCount(0, $context['results']['files'] ?? []);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.