function ViewsUITourTest::createTranslation

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/ViewsUITourTest.php \Drupal\Tests\views_ui\Functional\ViewsUITourTest::createTranslation()
  2. 8.9.x core/modules/views_ui/tests/src/Functional/ViewsUITourTest.php \Drupal\Tests\views_ui\Functional\ViewsUITourTest::createTranslation()
  3. 11.x core/modules/tour/tests/src/Functional/ViewsUi/ViewsUITourTest.php \Drupal\Tests\tour\Functional\ViewsUi\ViewsUITourTest::createTranslation()

Creates single translation for source string.

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

File

core/modules/tour/tests/src/Functional/ViewsUi/ViewsUITourTest.php, line 115

Class

ViewsUITourTest
Tests the Views UI tour.

Namespace

Drupal\Tests\tour\Functional\ViewsUi

Code

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

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