You are here

public function ViewsUITourTest::createTranslation in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views_ui/tests/src/Functional/ViewsUITourTest.php \Drupal\Tests\views_ui\Functional\ViewsUITourTest::createTranslation()

Creates single translation for source string.

1 call to ViewsUITourTest::createTranslation()
ViewsUITourTest::testViewsUiTourTipsTranslated in core/modules/views_ui/tests/src/Functional/ViewsUITourTest.php
Tests views_ui tour tip availability in a different language.

File

core/modules/views_ui/tests/src/Functional/ViewsUITourTest.php, line 109

Class

ViewsUITourTest
Tests the Views UI tour.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function createTranslation($source, $langcode) {
  return $this->localeStorage
    ->createTranslation([
    'lid' => $source->lid,
    'language' => $langcode,
    'translation' => $this
      ->randomMachineName(100),
  ])
    ->save();
}