You are here

function EntityTranslationMenuTranslationTestCase::createPage in Entity Translation 7

Create page with menu item.

Overrides EntityTranslationTestCase::createPage

3 calls to EntityTranslationMenuTranslationTestCase::createPage()
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 49
Tests for Entity translation module.

Class

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

Code

function createPage($link_title, $description, $langcode) {
  $edit = array();
  $edit['title'] = $this
    ->randomName();
  $edit['language'] = $langcode;
  $edit['menu[enabled]'] = TRUE;
  $edit['menu[link_title]'] = $link_title;
  $edit['menu[description]'] = $description ? $description : 'link language = ' . $langcode;
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));
  $this
    ->assertRaw(t('Basic page %title has been created.', array(
    '%title' => $edit['title'],
  )), t('Basic page created.'));

  // Check to make sure the node was created.
  $node = $this
    ->drupalGetNodeByTitle($edit['title']);
  $this
    ->assertTrue($node, t('Node found in database.'));

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