function LocaleBatchTest::testNonEnglishLanguagesUnaffected

Tests non-English languages do not skip default drupal.org pattern.

File

core/modules/locale/tests/src/Kernel/LocaleBatchTest.php, line 85

Class

LocaleBatchTest
Tests locale batches.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testNonEnglishLanguagesUnaffected() : void {
  $this->installConfig([
    'locale',
    'language',
  ]);
  $this->installSchema('locale', [
    'locales_source',
    'locales_target',
    'locale_file',
  ]);
  $this->container
    ->get('module_handler')
    ->loadInclude('locale', 'batch.inc');
  $source = (object) [
    'name' => 'test_module',
    'langcode' => 'de',
    '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.de.po',
      ],
    ],
  ];
  \Drupal::keyValue('locale.translation_status')->setMultiple([
    'test_module' => [
      'de' => $source,
    ],
  ]);
  $context = [
    'results' => [],
  ];
  locale_translation_batch_status_check('test_module', 'de', [
    'use_remote' => TRUE,
    'finish_feedback' => TRUE,
  ], $context);
  $this->assertContains('test_module', $context['results']['files']);
  $this->assertCount(0, $context['results']['failed_files'] ?? []);
}

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