You are here

public function LocaleSourceTest::assertTranslation in Translation Management Tool 8

Asserts a locale translation.

Parameters

int $lid: The locale source id.

string $target_langcode: The target language code.

string $expected_translation: The expected translation.

1 call to LocaleSourceTest::assertTranslation()
LocaleSourceTest::testSingularTerm in sources/locale/tests/src/Kernel/LocaleSourceTest.php
Tests translation of a locale singular term.

File

sources/locale/tests/src/Kernel/LocaleSourceTest.php, line 231

Class

LocaleSourceTest
Basic Locale Source tests.

Namespace

Drupal\Tests\tmgmt_locale\Kernel

Code

public function assertTranslation($lid, $target_langcode, $expected_translation) {
  $actual_translation = \Drupal::database()
    ->query('SELECT * FROM {locales_target} WHERE lid = :lid AND language = :language', array(
    ':lid' => $lid,
    ':language' => $target_langcode,
  ))
    ->fetch();
  $this
    ->assertEqual($actual_translation->translation, $expected_translation);
  $this
    ->assertEqual($actual_translation->customized, LOCALE_CUSTOMIZED);
}