You are here

function TMGMTCRUDTestCase::testTranslators in Translation Management Tool 7

Test crud operations of translators.

File

tests/tmgmt.crud.test, line 24

Class

TMGMTCRUDTestCase
Basic CRUD tests.

Code

function testTranslators() {
  $translator = $this
    ->createTranslator();
  $loaded_translator = tmgmt_translator_load($translator->tid);
  $this
    ->assertEqual($translator->name, $loaded_translator->name);
  $this
    ->assertEqual($translator->label, $loaded_translator->label);
  $this
    ->assertEqual($translator->settings, $loaded_translator->settings);

  // Update the settings.
  $translator->settings['new_key'] = $this
    ->randomString();
  $this
    ->assertEqual(SAVED_UPDATED, $translator
    ->save());
  $loaded_translator = tmgmt_translator_load($translator->tid);
  $this
    ->assertEqual($translator->name, $loaded_translator->name);
  $this
    ->assertEqual($translator->label, $loaded_translator->label);
  $this
    ->assertEqual($translator->settings, $loaded_translator->settings);

  // Delete the translator, make sure the translator is gone.
  $translator
    ->delete();
  $this
    ->assertFalse(tmgmt_translator_load($translator->tid));
}