function TMGMTKernelTestBase::createTranslator

Creates, saves and returns a translator.

Return value

\Drupal\tmgmt\TranslatorInterface

5 calls to TMGMTKernelTestBase::createTranslator()
CrudTest::testAddingTranslatedData in tests/src/Kernel/CrudTest.php
Tests adding translated data and revision handling.
CrudTest::testContinuousTranslators in tests/src/Kernel/CrudTest.php
Test crud operations of jobs.
CrudTest::testPreliminaryState in tests/src/Kernel/CrudTest.php
Tests that with the preliminary state the item does not change.
CrudTest::testRemoteMappings in tests/src/Kernel/CrudTest.php
CrudTest::testTranslators in tests/src/Kernel/CrudTest.php
Test crud operations of translators.

File

tests/src/Kernel/TMGMTKernelTestBase.php, line 55

Class

TMGMTKernelTestBase
Base class for tests.

Namespace

Drupal\Tests\tmgmt\Kernel

Code

function createTranslator() {
  $translator = Translator::create([
    'name' => strtolower($this
      ->randomMachineName()),
    'label' => $this
      ->randomMachineName(),
    'plugin' => 'test_translator',
    'remote_languages_mappings' => [],
    'settings' => [
      'key' => $this
        ->randomMachineName(),
      'another_key' => $this
        ->randomMachineName(),
    ],
  ]);
  $this
    ->assertEquals(SAVED_NEW, $translator
    ->save());
  return $translator;
}