You are here

function EntityTranslationMenuTranslationTestCase::createTranslation in Entity Translation 7

Create a translation with menu item.

Overrides EntityTranslationTestCase::createTranslation

3 calls to EntityTranslationMenuTranslationTestCase::createTranslation()
EntityTranslationMenuTranslationTestCase::testMenuLocalization in entity_translation_i18n_menu/entity_translation_i18n_menu.test
Test if menu localization works.
EntityTranslationMenuTranslationTestCase::testMenuLocalizationCustomSourceLanguage in entity_translation_i18n_menu/entity_translation_i18n_menu.test
Test if menu localization works (source language != default language).
EntityTranslationMenuTranslationTestCase::testMenuTranslation in entity_translation_i18n_menu/entity_translation_i18n_menu.test
Test if menu translation works with separate menu items.

File

entity_translation_i18n_menu/entity_translation_i18n_menu.test, line 73
Tests for Entity translation module.

Class

EntityTranslationMenuTranslationTestCase
Tests for the translation of menu items on entity forms.

Code

function createTranslation($node, $link_title, $description, $langcode, $use_tsets = FALSE) {
  $this
    ->drupalGet('node/' . $node->nid . '/edit/add/' . $node->language . '/' . $langcode);
  $edit = array();
  $edit['menu[enabled]'] = TRUE;
  $edit['menu[link_title]'] = $link_title;
  $edit['menu[description]'] = $description ? $description : 'link language = ' . $langcode;
  if ($use_tsets != NULL) {
    $edit['menu[tset]'] = $use_tsets;
  }
  $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.'));

  // Check to make sure menu link was created.
  $this
    ->get($langcode, '<front>');
  $this
    ->assertText($link_title, 'Translation menu link found.');
  return $node;
}