You are here

function TMGMTEntitySourceListTestCase::testTranslationSubmissions in Translation Management Tool 7

File

sources/entity/ui/tmgmt_entity_ui.list.test, line 141

Class

TMGMTEntitySourceListTestCase

Code

function testTranslationSubmissions() {

  // Simple submission.
  $nid = $this->nodes['article']['en'][0]->nid;
  $edit = array();
  $edit["items[{$nid}]"] = 1;
  $this
    ->drupalPost('admin/tmgmt/sources/entity_node', $edit, t('Request translation'));
  $this
    ->assertText(t('One job needs to be checked out.'));

  // Submission of two entities of the same source language.
  $nid1 = $this->nodes['article']['en'][0]->nid;
  $nid2 = $this->nodes['article']['en'][1]->nid;
  $edit = array();
  $edit["items[{$nid1}]"] = 1;
  $edit["items[{$nid2}]"] = 1;
  $this
    ->drupalPost('admin/tmgmt/sources/entity_node', $edit, t('Request translation'));
  $this
    ->assertText(t('One job needs to be checked out.'));

  // Submission of several entities of different source languages.
  $nid1 = $this->nodes['article']['en'][0]->nid;
  $nid2 = $this->nodes['article']['en'][1]->nid;
  $nid3 = $this->nodes['article']['en'][2]->nid;
  $nid4 = $this->nodes['article']['en'][3]->nid;
  $nid5 = $this->nodes['article']['de'][0]->nid;
  $nid6 = $this->nodes['article']['fr'][0]->nid;
  $edit = array();
  $edit["items[{$nid1}]"] = 1;
  $edit["items[{$nid2}]"] = 1;
  $edit["items[{$nid3}]"] = 1;
  $edit["items[{$nid4}]"] = 1;
  $edit["items[{$nid5}]"] = 1;
  $edit["items[{$nid6}]"] = 1;
  $this
    ->drupalPost('admin/tmgmt/sources/entity_node', $edit, t('Request translation'));
  $this
    ->assertText(t('@count jobs need to be checked out.', array(
    '@count' => '3',
  )));
}