function LocaleFileHashTest::assertHashes

Same name and namespace in other branches
  1. main 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 140

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 {
  drupal_static_reset('locale_translation_get_file_history');
  $history = locale_translation_get_file_history();
  $this->assertSame($history_hash, $history[$project][$langcode]->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.