You are here

function TMGMTI18nStringSourceTestCase::testI18nStringPluginUIBlock in Translation Management Tool 7

Tests translation of blocks through the user interface.

File

sources/i18n_string/tmgmt_i18n_string.test, line 351

Class

TMGMTI18nStringSourceTestCase
Basic i18n String Source tests.

Code

function testI18nStringPluginUIBlock() {
  $this
    ->loginAsAdmin(array(
    'administer blocks',
    'translate interface',
    'translate user-defined strings',
  ));

  // Make some blocks translatable.
  $navigation_edit = array(
    'title' => $this
      ->randomName(),
    'i18n_mode' => 1,
  );
  $this
    ->drupalPost('admin/structure/block/manage/system/navigation/configure', $navigation_edit, t('Save block'));
  $powered_edit = array(
    'title' => $this
      ->randomName(),
    'i18n_mode' => 1,
  );
  $this
    ->drupalPost('admin/structure/block/manage/system/powered-by/configure', $powered_edit, t('Save block'));
  $this
    ->drupalGet('admin/tmgmt/sources/i18n_string_block');
  $this
    ->assertText($navigation_edit['title']);
  $this
    ->assertText($powered_edit['title']);

  // Request translation via i18n source tab.
  $edit = array(
    'items[blocks:system:powered-by]' => 1,
    'items[blocks:system:navigation]' => 1,
  );
  $this
    ->drupalPost(NULL, $edit, t('Request translation'));
  $this
    ->assertText($navigation_edit['title']);
  $this
    ->assertText($powered_edit['title']);
  $this
    ->drupalPost(NULL, array(), t('Submit to translator'));
  $this
    ->assertRaw(t('Active job item: Needs review'));
}