You are here

function MenuAttributesTestBase::crudMenuLink in Menu Attributes 8

Add or edit a menu link using the menu module UI.

Parameters

integer $plid: Parent menu link id.

string $link: Link path.

string $menu_name: Menu name.

Return value

array Menu link created.

File

src/Tests/MenuAttributesTestBase.php, line 86

Class

MenuAttributesTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\menu_attributes\Tests

Code

function crudMenuLink($mlid = 0, $plid = 0, $link = '<front>', $menu_name = 'navigation') {

  //    // View add/edit menu link page.
  //    if (empty($mlid)) {
  //      $this->drupalGet("admin/structure/menu/manage/$menu_name/add");
  //      $menu_attributes = $this->menu_attributes_new;
  //    }
  //    else {
  //      $this->drupalGet("admin/structure/menu/item/$mlid/edit");
  //      $menu_attributes = $this->menu_attributes_edit;
  //    }
  //    $this->assertResponse(200);
  //
  //    $title = '!link_' . $this->randomMachineName(16);
  //    $edit = [
  //      'link_path' => $link,
  //      'link_title' => $title,
  //      'enabled' => TRUE, // Use this to disable the menu and test.
  //      'expanded' => TRUE, // Setting this to true should test whether it works when we do the std_user tests.
  //      'parent' =>  $menu_name . ':' . $plid,
  //      'weight' => '0',
  //      'options[attributes][title]' => $menu_attributes['title'],
  //      'options[attributes][id]' => $menu_attributes['id'],
  //      'options[attributes][name]' => $menu_attributes['name'],
  //      'options[attributes][rel]' => $menu_attributes['rel'],
  //      'options[attributes][class]' => $menu_attributes['class'],
  //      'options[attributes][style]' => $menu_attributes['style'],
  //      'options[attributes][target]' => $menu_attributes['target'],
  //      'options[attributes][accesskey]' => $menu_attributes['accesskey'],
  //    ];
  //
  //    // Add menu link.
  //    $this->drupalPostForm(NULL, $edit, t('Save'));
  //
  //    $item = db_query('SELECT * FROM {menu_links} WHERE link_title = :title', [':title' => $title])->fetchAssoc());
  //
  //    return $item;
}