function LocaleFileHashTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/locale/tests/src/Functional/LocaleFileHashTest.php \Drupal\Tests\locale\Functional\LocaleFileHashTest::setUp()

Overrides LocaleUpdateBase::setUp

File

core/modules/locale/tests/src/Functional/LocaleFileHashTest.php, line 28

Class

LocaleFileHashTest
Tests that file hash is used for local translation file change detection.

Namespace

Drupal\Tests\locale\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $admin_user = $this->drupalCreateUser([
    'administer modules',
    'administer site configuration',
    'administer languages',
    'access administration pages',
    'translate interface',
  ]);
  $this->drupalLogin($admin_user);
  $this->addLanguage('de');
  // Import the translations via the UI.
  $this->setTranslationFiles();
  $this->setCurrentTranslations();
  $edit = [
    'use_source' => LOCALE_TRANSLATION_USE_SOURCE_LOCAL,
    'overwrite' => LOCALE_TRANSLATION_OVERWRITE_ALL,
  ];
  $this->drupalGet('admin/config/regional/translate/settings');
  $this->submitForm($edit, 'Save configuration');
  // Check for available translations and update them via the UI.
  $this->drupalGet('admin/reports/translations/check');
  $this->assertSession()
    ->addressEquals('admin/reports/translations');
  $this->submitForm([], 'Update translations');
}

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