You are here

function TMGMTI18nStringSourceTestCase::testI18nStringSourceLangCodes in Translation Management Tool 7

File

sources/i18n_string/tmgmt_i18n_string.test, line 227

Class

TMGMTI18nStringSourceTestCase
Basic i18n String Source tests.

Code

function testI18nStringSourceLangCodes() {
  $config = array(
    'name' => $this
      ->randomName(),
    'description' => 'description_' . $this
      ->randomName(),
    'machine_name' => 'test_vocab',
    'i18n_mode' => I18N_MODE_LOCALIZE,
  );
  $vocabulary = entity_create('taxonomy_vocabulary', $config);
  taxonomy_vocabulary_save($vocabulary);
  $string_object_name = "taxonomy:vocabulary:" . $vocabulary->vid;

  // Create the new job and job item.
  $job = $this
    ->createJob();
  $job->translator = $this->translator->name;
  $job->settings = array();
  $job
    ->save();
  $item = $job
    ->addItem('i18n_string', 'taxonomy_vocabulary', $string_object_name);
  $this
    ->assertJobItemLangCodes($item, 'en', array(
    'en',
  ));
  i18n_string_translation_update($string_object_name . ':description', 'de_' . $config['description'], 'de');
  $this
    ->assertJobItemLangCodes($item, 'en', array(
    'en',
  ));
  i18n_string_translation_update($string_object_name . ':name', 'de_' . $config['name'], 'de');
  $this
    ->assertJobItemLangCodes($item, 'en', array(
    'en',
    'de',
  ));
}