You are here

function EntityTranslationMenuTranslationTestCase::testMenuLocalizationCustomSourceLanguage in Entity Translation 7

Test if menu localization works (source language != default language).

File

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

Class

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

Code

function testMenuLocalizationCustomSourceLanguage() {

  // Create Basic page in Spanish.
  $link_title_es = $this
    ->randomName();
  $node = $this
    ->createPage($link_title_es, NULL, 'es');

  // Submit translation in English.
  $link_title_en = $this
    ->randomName();
  $node_translation = $this
    ->createTranslation($node, $link_title_en, NULL, 'en');

  // Check menu links in both languages.
  $this
    ->get('es', '<front>');
  $this
    ->assertText($link_title_es);
  $this
    ->get('en', '<front>');
  $this
    ->assertText($link_title_en);

  // Edit Spanish menu link.
  $link_title_es2 = $this
    ->randomName();
  $this
    ->editPage($node, $link_title_es, $link_title_es2, 'es');

  // Check that English menu link has not changed.
  $this
    ->get('en', '<front>');
  $this
    ->assertText($link_title_en);

  // Edit English menu link.
  $link_title_en2 = $this
    ->randomName();
  $this
    ->editPage($node, $link_title_en, $link_title_en2, 'en');

  // Check that Spanish menu link has not changed.
  $this
    ->get('es', '<front>');
  $this
    ->assertText($link_title_es2);
}