You are here

function TMGMTBaseTestCase::createTranslator in Translation Management Tool 7

Creates, saves and returns a translator.

Return value

TMGMTTranslator

10 calls to TMGMTBaseTestCase::createTranslator()
TMGMTCRUDTestCase::testAddingTranslatedData in tests/tmgmt.crud.test
Tests adding translated data and revision handling.
TMGMTCRUDTestCase::testRemoteMappings in tests/tmgmt.crud.test
TMGMTCRUDTestCase::testTranslators in tests/tmgmt.crud.test
Test crud operations of translators.
TMGMTFileTestCase::testHTML in translators/file/tmgmt_file.test
Tests export and import for the HTML format.
TMGMTFileTestCase::testPrivate in translators/file/tmgmt_file.test
Tests storing files in the private file system.

... See full list

File

tests/tmgmt.base.test, line 136

Class

TMGMTBaseTestCase
Base class for tests.

Code

function createTranslator() {
  $translator = new TMGMTTranslator();
  $translator->name = strtolower($this
    ->randomName());
  $translator->label = $this
    ->randomName();
  $translator->plugin = 'test_translator';
  $translator->settings = array(
    'key' => $this
      ->randomName(),
    'another_key' => $this
      ->randomName(),
  );
  $this
    ->assertEqual(SAVED_NEW, $translator
    ->save());

  // Assert that the translator was assigned a tid.
  $this
    ->assertTrue($translator->tid > 0);
  return $translator;
}