public function EntityTranslationHierarchyBaseTestCase::createTranslation in Language Hierarchy 7
Create a translation.
Parameters
$node: Node of the basic page to create translation for.
$body: Body of the basic page in the specified language.
$langcode: The language code to be assigned to the specified values.
4 calls to EntityTranslationHierarchyBaseTestCase::createTranslation()
- EntityTranslationHierarchyViewsWebTestCase::testViewsSupport in modules/
entity_translation_hierarchy/ tests/ entity_translation_hierarchy.test - Test support for inheritance in views.
- EntityTranslationHierarchyWebTestCase::testBlockingOfTranslation in modules/
entity_translation_hierarchy/ tests/ entity_translation_hierarchy.test - Test if translation blocking mechanism is working as expected when viewing node.
- EntityTranslationHierarchyWebTestCase::testFieldTranslationInheritance in modules/
entity_translation_hierarchy/ tests/ entity_translation_hierarchy.test - Test if translations are properly displayed when viewing node page.
- XMLSitemapLanguageHierarchyStringTranslationWebTestCase::testSiteMapLanguageLinks in modules/
xmlsitemap_language_hierarchy/ tests/ xmlsitemap_language_hierarchy.test
File
- modules/
entity_translation_hierarchy/ tests/ entity_translation_hierarchy.test, line 76 - Tests for Entity Translation Hierarchy module.
Class
- EntityTranslationHierarchyBaseTestCase
- Base class for Entity Translation Hierarchy module tests.
Code
public function createTranslation($node, $body, $langcode, $source_langcode = 'en') {
$this
->drupalGet('node/' . $node->nid . '/edit/add/' . $source_langcode . '/' . $langcode);
$body_key = "body[{$langcode}][0][value]";
$this
->assertFieldByXPath("//textarea[@name='{$body_key}']", $node->body[$node->language][0]['value'], 'Original body value correctly populated.');
$this
->assertFieldById('edit-body-' . $langcode . '-add-more', t('Add another item'), t('Add another item button found.'));
$edit = array();
$edit[$body_key] = $body;
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->drupalGet('node/' . $node->nid . '/translate');
$this
->assertLinkByHref('node/' . $node->nid . '/edit/' . $langcode, 0, t('Translation edit link found. Translation created.'));
return $node;
}