trying to make a test for menu module - for a form with #tree = TRUE.

Add a new menu link to the navigation menu at the path admin/build/menu-customize/navigation/add

When I started to build a testing using this module it suggests the following for the POST:

$edit = array (
  'menu' => 
  array (
    'link_path' => '<front>',
    'link_title' => $title
    'description' => '',
    'parent' => 'navigation:0',
    'weight' => '0',
  ),
  'op' => 'Save',
  'form_id' => 'menu_edit_item',
);
$this->drupalPostRequest("admin/build/menu-customize/navigation/add", $edit, "Save");

But that totally fails. I got this working now using instead:

    $edit = array (
        'menu[link_path]' => '<front>',
        'menu[link_title]' => $title,
        'menu[description]' => '',
        'menu[parent]' => 'navigation:0',
        'menu[weight]' => '0',
    );

    $this->drupalPostRequest(url("admin/build/menu-customize/navigation/add", array('absolute' => TRUE)), $edit, "Save");

Comments

chx’s picture

something is funny here, dump $_POST and see.

chx’s picture

Status: Active » Fixed

Ah yes. I see and fixed it.

pwolanin’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)