You are here

protected function TMGMTFileTestCase::assertIntegrityCheck in Translation Management Tool 7

Asserts import integrity for a job.

Parameters

TMGMTJob $job: The job to check.

bool $expected: (optional) If an integrity failed message is expected or not, defaults to FALSE.

1 call to TMGMTFileTestCase::assertIntegrityCheck()
TMGMTFileTestCase::testXLIFFTextProcessing in translators/file/tmgmt_file.test
Test the content processing for XLIFF export and import.

File

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

Class

TMGMTFileTestCase
Basic tests for the file translator.

Code

protected function assertIntegrityCheck(TMGMTJob $job, $expected = TRUE) {
  $integrity_check_failed = FALSE;

  /** @var TMGMTMessage $message */
  foreach ($job
    ->getMessages() as $message) {
    if ($message
      ->getMessage() == t('Failed to validate semantic integrity of %key element. Please check also the HTML code of the element in the review process.', array(
      '%key' => 'dummy][deep_nesting',
    ))) {
      $integrity_check_failed = TRUE;
      break;
    }
  }

  // Check if the message was found or not, based on the expected argument.
  if ($expected) {
    $this
      ->assertTrue($integrity_check_failed, 'The validation of semantic integrity must fail.');
  }
  else {
    $this
      ->assertFalse($integrity_check_failed, 'The validation of semantic integrity must not fail.');
  }
}