public function LingotekTaxonomyTermTranslationTest::testTermTranslation in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 4.0.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.0.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.1.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.2.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.3.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.4.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.5.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.7.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
- 3.8.x tests/src/Functional/LingotekTaxonomyTermTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekTaxonomyTermTranslationTest::testTermTranslation()
Tests that a term can be translated.
File
- tests/
src/ Functional/ LingotekTaxonomyTermTranslationTest.php, line 83
Class
- LingotekTaxonomyTermTranslationTest
- Tests translating a taxonomy term.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testTermTranslation() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
$bundle = $this->vocabulary
->id();
// Create a term.
$edit = [];
$edit['name[0][value]'] = 'Llamas are cool';
$edit['description[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$this
->drupalPostForm("admin/structure/taxonomy/manage/{$bundle}/add", $edit, t('Save'));
$this->term = Term::load(1);
// Check that only the configured fields have been uploaded.
$data = json_decode(\Drupal::state()
->get('lingotek.uploaded_content', '[]'), TRUE);
$this
->assertUploadedDataFieldCount($data, 2);
$this
->assertTrue(isset($data['name'][0]['value']));
$this
->assertEqual(1, count($data['description'][0]));
$this
->assertTrue(isset($data['description'][0]['value']));
// Check that the translate tab is in the node.
$this
->drupalGet('taxonomy/term/1');
$this
->clickLink('Translate');
// The document should have been automatically uploaded, so let's check
// the upload status.
$this
->clickLink('Check Upload Status');
$this
->assertText('The import for taxonomy_term Llamas are cool is complete.');
// Request translation.
$this
->clickLink('Request translation');
$this
->assertText("Locale 'es_ES' was added as a translation target for taxonomy_term Llamas are cool.");
// Check translation status.
$this
->clickLink('Check translation status');
$this
->assertText('The es_ES translation for taxonomy_term Llamas are cool is ready for download.');
// Download translation.
$this
->clickLink('Download completed translation');
$this
->assertText('The translation of taxonomy_term Llamas are cool into es_ES has been downloaded.');
// The content is translated and published.
$this
->clickLink('Las llamas son chulas');
$this
->assertText('Las llamas son chulas');
$this
->assertText('Las llamas son muy chulas');
}