public function EntityTranslationHierarchyWebTestCase::testFieldTranslationInheritance in Language Hierarchy 7
Test if translations are properly displayed when viewing node page.
File
- modules/
entity_translation_hierarchy/ tests/ entity_translation_hierarchy.test, line 116 - Tests for Entity Translation Hierarchy module.
Class
- EntityTranslationHierarchyWebTestCase
- Functional tests for entity translation.
Code
public function testFieldTranslationInheritance() {
// Create Basic page in English.
$node_title = $this
->randomName();
$node_body = $this
->randomName();
$node = $this
->createPageNode($node_title, $node_body, 'en');
// Submit translation in Portuguese, Portugal.
$node_translation_body_pt_pt = $this
->randomName();
$this
->createTranslation($node, $node_translation_body_pt_pt, 'pt-pt');
// Submit translation in Portuguese, International.
$node_translation_body_pt = $this
->randomName();
$this
->createTranslation($node, $node_translation_body_pt, 'pt');
$this
->drupalLogout();
$this
->get('pt', 'node/' . $node->nid);
$this
->assertText($node_translation_body_pt, 'Portuguese, International content found.');
$this
->get('pt-pt', 'node/' . $node->nid);
$this
->assertText($node_translation_body_pt_pt, 'Portuguese, Portugal content found.');
// Check if for language content is inherited from parent.
$this
->get('pt-br', 'node/' . $node->nid);
$this
->assertText($node_translation_body_pt, 'Portuguese, Brazil translation is inheriting content from parent.');
}