public function LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved in Lingotek Translation 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 4.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.2.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.3.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.4.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.5.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.6.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.7.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
- 3.8.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslationWhenBodyRemoved()
Tests that a node is correctly translated after body is deleted.
File
- tests/
src/ Functional/ LingotekNodeTranslationTest.php, line 311
Class
- LingotekNodeTranslationTest
- Tests translating a node.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testEditedNodeTranslationWhenBodyRemoved() {
// We need a node with translations first.
$this
->testNodeTranslation();
// Edit the node.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool EDITED';
$edit['body[0][value]'] = '';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'automatic';
$this
->saveAndKeepPublishedThisTranslationNodeForm($edit, 1);
$this
->clickLink('Translate');
// Re-upload.
$this
->clickLink('Upload');
$this
->checkForMetaRefresh();
$this
->assertText('Uploaded 1 document to Lingotek.');
// Check that only the configured fields have been uploaded.
$data = json_decode(\Drupal::state()
->get('lingotek.uploaded_content', '[]'), TRUE);
$this
->assertUploadedDataFieldCount($data, 3);
$this
->assertTrue(isset($data['title'][0]['value']));
$this
->assertTrue(isset($data['body']));
$this
->assertEmpty(count($data['body']));
\Drupal::state()
->set('lingotek.uploaded_content_type', 'node+emptybody');
// Recheck status.
$this
->clickLink('Check translation status');
$this
->assertText('The es_MX translation for node Llamas are cool EDITED is ready for download.');
// Download the translation.
$this
->clickLink('Download completed translation');
$this
->assertText('The translation of node Llamas are cool EDITED into es_MX has been downloaded.');
$this
->clickLink('Las llamas son chulas EDITADO');
$this
->assertNoText('Las llamas son muy chulas');
}