You are here

function MenuTranslationHierarchyBaseTestCase::createMenuLinkTranslationSet in Language Hierarchy 7

Helper function to create a translation set.

File

modules/i18n_menu_hierarchy/tests/i18n_menu_hierarchy.test, line 60
Tests for Menu Translation Hierarchy module.

Class

MenuTranslationHierarchyBaseTestCase
Base class for Menu Translation Hierarchy module tests.

Code

function createMenuLinkTranslationSet($edit = array()) {
  $edit += array(
    'title' => $this
      ->randomName(16),
  );
  $this
    ->drupalPost('admin/structure/menu/manage/translation/add', $edit, t('Save'));

  // Load translation set entity.
  $entity = entity_load('i18n_translation', FALSE, array(
    'title' => $edit['title'],
  ), TRUE);
  if (empty($entity)) {
    $this
      ->fail('Could not create a translation set.', 'i18n_translation');
    return FALSE;
  }
  return reset($entity);
}