public function BaseFlowTest::testUploadFileAndDownloadTranslation in TMGMT Translator Smartling 8.2
Test upload and download translation.
File
- src/
Tests/ BaseFlowTest.php, line 15
Class
- BaseFlowTest
- Basic flow tests.
Namespace
Drupal\tmgmt_smartling\TestsCode
public function testUploadFileAndDownloadTranslation() {
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);
// Download translated file.
$this
->downloadAndCheckTranslatedFile($job
->id(), $fileName);
// Check translation.
$this
->drupalGet("{$this->targetLanguage}/node/{$this->testNodeId}");
$this
->assertResponse(200);
$this
->assertNoText($this->testNodeTitle);
$this
->deleteTestFile($fileName);
}
else {
$this
->fail("Smartling settings file for simpletests not found.");
}
}