protected function SmartlingTestBase::checkGeneratedFile in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 tests/src/Functional/SmartlingTestBase.php \Drupal\Tests\tmgmt_smartling\Functional\SmartlingTestBase::checkGeneratedFile()
Checks if generated file exists and correct.
Parameters
$fileName:
$nodeTitle:
string $format:
9 calls to SmartlingTestBase::checkGeneratedFile()
- BaseFlowTest::testUploadFileAndDownloadTranslation in tests/
src/ Functional/ BaseFlowTest.php - Test upload and download translation.
- BaseFlowTest::testUploadXlfChangeToXmlDownloadXlf in tests/
src/ Functional/ BaseFlowTest.php - Test uploading/downloading xlf file: rely on file name in tmgmt_job.
- BaseFlowTest::testUploadXmlChangeToXlfDownloadXml in tests/
src/ Functional/ BaseFlowTest.php - Test uploading/downloading xml file: rely on file name in tmgmt_job.
- ContextTest::testSmartlingContextDebuggerSendContext in tests/
src/ Functional/ ContextTest.php - Test Smartling context debugger: send context.
- PushBackControllerTest::testPushBackExistingJobWithoutFileUri in tests/
src/ Functional/ PushBackControllerTest.php - Push back existing job without file uri.
File
- tests/
src/ Functional/ SmartlingTestBase.php, line 224
Class
- SmartlingTestBase
- Basic tests for the Smartling translator.
Namespace
Drupal\Tests\tmgmt_smartling\FunctionalCode
protected function checkGeneratedFile($fileName, $nodeTitle, $format = 'xml') {
$file_path = \Drupal::getContainer()
->get('file_system')
->realpath(file_default_scheme() . "://tmgmt_sources/{$fileName}");
$content = file_get_contents($file_path);
$this
->assertTrue(strpos($content, $nodeTitle) !== FALSE, 'Title is in file');
$no_directives = $format != 'xml';
$this
->assertTrue(strpos($content, '<limit>255</limit>') !== $no_directives);
$this
->assertTrue(strpos($content, '<span sl-variant="node-3-title][0][value" class="atom" id="bMV1bdGl0bGVdWzBdW3ZhbHVl">') !== $no_directives);
$this
->assertTrue(strpos($content, '<limit>NONE</limit>') !== $no_directives);
$this
->assertTrue(strpos($content, '<div sl-variant="node-3-body][0][value" class="atom" id="bMV1bYm9keV1bMF1bdmFsdWU">') !== $no_directives);
}