public function LingotekNodeTranslationTest::testDownloadingInvalidRevision in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 4.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.1.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.2.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.3.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.4.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.5.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.6.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
- 3.8.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testDownloadingInvalidRevision()
Tests downloading a translation for an invalid revision.
File
- tests/
src/ Functional/ LingotekNodeTranslationTest.php, line 1379
Class
- LingotekNodeTranslationTest
- Tests translating a node.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDownloadingInvalidRevision() {
// This is a hack for avoiding writing different lingotek endpoint mocks.
\Drupal::state()
->set('lingotek.uploaded_content_type', 'node+invalidrevision');
// Create a node.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'automatic';
$this
->saveAndPublishNodeForm($edit);
// Check that the translate tab is in the node.
$this
->clickLink('Translate');
$this
->clickLink('Check Upload Status');
$this
->assertText('The import for node Llamas are cool is complete.');
// Request translation.
$this
->clickLink('Request translation');
// Simulate the notification of content successfully translated.
$url = Url::fromRoute('lingotek.notify', [], [
'query' => [
'project_id' => 'test_project',
'document_id' => 'dummy-document-hash-id',
'locale_code' => 'es-MX',
'locale' => 'es_MX',
'complete' => 'true',
'type' => 'target',
'progress' => '100',
],
])
->setAbsolute()
->toString();
$request = $this->client
->post($url, [
'cookies' => $this->cookies,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'http_errors' => FALSE,
]);
$response = json_decode($request
->getBody(), TRUE);
$this
->assertTrue($response['result']['download'], 'Spanish language has been downloaded after notification automatically.');
$this
->assertEqual('Document downloaded.', $response['messages'][0]);
$this
->drupalGet('node/1/translations');
$this
->assertText('Las llamas son chulas');
}