You are here

public function LocaleStringTest::createTranslation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/Tests/LocaleStringTest.php \Drupal\locale\Tests\LocaleStringTest::createTranslation()

Creates single translation for source string.

2 calls to LocaleStringTest::createTranslation()
LocaleStringTest::createAllTranslations in core/modules/locale/src/Tests/LocaleStringTest.php
Creates translations for source string and all languages.
LocaleStringTest::testStringCRUDAPI in core/modules/locale/src/Tests/LocaleStringTest.php
Test CRUD API.

File

core/modules/locale/src/Tests/LocaleStringTest.php, line 202
Contains \Drupal\locale\Tests\LocaleStringTest.

Class

LocaleStringTest
Tests the locale string storage, string objects and data API.

Namespace

Drupal\locale\Tests

Code

public function createTranslation($source, $langcode, $values = array()) {
  return $this->storage
    ->createTranslation($values + array(
    'lid' => $source->lid,
    'language' => $langcode,
    'translation' => $this
      ->randomMachineName(100),
  ))
    ->save();
}