function LocaleFileHashTest::assertHashes

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

Checks that the stored hash values are as expected.

Parameters

string $history_hash: The expected hash value in the locale_file table.

string $status_hash: The expected hash in the translation status key value store.

string $project: The translation project.

string $langcode: The langcode.

1 call to LocaleFileHashTest::assertHashes()
LocaleFileHashTest::testModifiedFileProducesDifferentHash in core/modules/locale/tests/src/Functional/LocaleFileHashTest.php
Tests that modifying a file produces a different hash, detected by the UI.

File

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

Class

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

Namespace

Drupal\Tests\locale\Functional

Code

public function assertHashes(string $history_hash, string $status_hash, string $project, string $langcode) : void {
  $current_import = \Drupal::service(CurrentImportStorage::class)->get($project, $langcode);
  $this->assertSame($history_hash, $current_import->hash);
  $status = locale_translation_get_status([
    $project,
  ]);
  $this->assertSame($status_hash, $status[$project][$langcode]->hash);
  $this->assertSame($status_hash, $status[$project][$langcode]->files[LOCALE_TRANSLATION_LOCAL]->hash);
}

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