You are here

protected function TMGMTFileTestCase::importFile in Translation Management Tool 7

2 calls to TMGMTFileTestCase::importFile()
TMGMTFileTestCase::testHTML in translators/file/tmgmt_file.test
Tests export and import for the HTML format.
TMGMTFileTestCase::testXLIFF in translators/file/tmgmt_file.test
Tests import and export for the XLIFF format.

File

translators/file/tmgmt_file.test, line 448
Test cases for the file translator module.

Class

TMGMTFileTestCase
Basic tests for the file translator.

Code

protected function importFile($translated_file, $translated_text, TMGMTJob $job) {

  // To test the upload form functionality, navigate to the edit form.
  $uri = $job
    ->uri();
  $edit = array(
    'files[file]' => $translated_file,
  );
  $this
    ->drupalPost($uri['path'] . '/manage', $edit, t('Import'));

  // Make sure the translations have been imported correctly.
  $this
    ->assertNoText(t('In progress'));

  // @todo: Enable this assertion once new releases for views and entity
  // module are out.

  //$this->assertText(t('Needs review'));

  // Review both items.
  $this
    ->clickLink(t('review'));
  foreach ($translated_text[1] as $key => $value) {
    $this
      ->assertText(check_plain($value));
  }
  foreach ($translated_text[2] as $key => $value) {
    $this
      ->assertNoText(check_plain($value));
  }
  $this
    ->drupalPost(NULL, array(), t('Save as completed'));

  // Review both items.
  $this
    ->clickLink(t('review'));
  foreach ($translated_text[1] as $key => $value) {
    $this
      ->assertNoText(check_plain($value));
  }
  foreach ($translated_text[2] as $key => $value) {
    $this
      ->assertText(check_plain($value));
  }
  $this
    ->drupalPost(NULL, array(), t('Save as completed'));

  // @todo: Enable this assertion once new releases for views and entity
  // module are out.

  //$this->assertText(t('Accepted'));
  $this
    ->assertText(t('Finished'));
  $this
    ->assertNoText(t('Needs review'));
}