public function LocaleSourceTest::assertTranslation

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 232

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
    ->assertEquals($expected_translation, $actual_translation->translation);
  $this
    ->assertEquals(LOCALE_CUSTOMIZED, $actual_translation->customized);
}