function TMGMTTestBase::createTranslator in Translation Management Tool 8
Creates, saves and returns a translator.
Return value
\Drupal\tmgmt\TranslatorInterface
File
- src/
Tests/ TMGMTTestBase.php, line 159
Class
- TMGMTTestBase
- Base class for tests.
Namespace
Drupal\tmgmt\TestsCode
function createTranslator(array $values = []) {
$translator = Translator::create($values + [
'name' => strtolower($this
->randomMachineName()),
'label' => $this
->randomMachineName(),
'plugin' => 'test_translator',
'remote_languages_mappings' => [],
'settings' => empty($values['plugin']) ? [
'key' => $this
->randomMachineName(),
'another_key' => $this
->randomMachineName(),
] : [],
]);
$this
->assertEqual(SAVED_NEW, $translator
->save());
return $translator;
}