public function BaseFlowTest::testUploadXmlChangeToXlfDownloadXml in TMGMT Translator Smartling 8.3
Test uploading/downloading xml file: rely on file name in tmgmt_job.
File
- tests/
src/ Functional/ BaseFlowTest.php, line 46
Class
- BaseFlowTest
- Basic flow tests.
Namespace
Drupal\Tests\tmgmt_smartling\FunctionalCode
public function testUploadXmlChangeToXlfDownloadXml() {
if (!empty($this->smartlingPluginProviderSettings)) {
$translator = $this
->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);
$job = $this
->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
$fileName = $job
->getTranslatorPlugin()
->getFileName($job);
$this
->checkGeneratedFile($fileName, $this->testNodeTitle);
// Check fr node title before translation (should be same as en title).
$this
->drupalGet("{$this->targetLanguage}/node/{$this->testNodeId}");
$this
->assertResponse(200);
$this
->assertText($this->testNodeTitle);
// Change export format to xlf and download translated file.
$translator
->setSetting('export_format', 'xlf');
$translator
->save();
$this
->downloadAndCheckTranslatedFile($job
->id(), $fileName);
// Check translation.
$this
->drupalGet("{$this->targetLanguage}/node/{$this->testNodeId}");
$this
->assertResponse(200);
$this
->assertNoText($this->testNodeTitle);
}
else {
$this
->fail("Smartling settings file for simpletests not found.");
}
}