You are here

function HelperTest::testTMGTJobMatchItem in Translation Management Tool 8

Tests tmgmt_job_match_item()

See also

tmgmt_job_match_item

File

tests/src/Kernel/HelperTest.php, line 19

Class

HelperTest
Tests the helper functions in tmgmt.module.

Namespace

Drupal\Tests\tmgmt\Kernel

Code

function testTMGTJobMatchItem() {
  $this
    ->addLanguage('fr');
  $this
    ->addLanguage('es');

  // Add a job from en to fr and en to sp.
  $job_en_fr = $this
    ->createJob('en', 'fr');
  $job_en_sp = $this
    ->createJob('en', 'es');

  // Add a job which has existing source-target combinations.
  $this
    ->assertEqual($job_en_fr
    ->id(), tmgmt_job_match_item('en', 'fr')
    ->id());
  $this
    ->assertEqual($job_en_sp
    ->id(), tmgmt_job_match_item('en', 'es')
    ->id());

  // Add a job which has no existing source-target combination.
  $this
    ->assertTrue(tmgmt_job_match_item('fr', 'es') instanceof Job);
}