Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1140 diff -u -p -r1.1140 common.inc --- includes/common.inc 31 Mar 2010 19:10:39 -0000 1.1140 +++ includes/common.inc 6 Apr 2010 13:28:44 -0000 @@ -230,7 +230,7 @@ function drupal_get_profile() { function drupal_set_breadcrumb($breadcrumb = NULL) { $stored_breadcrumb = &drupal_static(__FUNCTION__); - if (!is_null($breadcrumb)) { + if (isset($breadcrumb)) { $stored_breadcrumb = $breadcrumb; } return $stored_breadcrumb; @@ -242,7 +242,7 @@ function drupal_set_breadcrumb($breadcru function drupal_get_breadcrumb() { $breadcrumb = drupal_set_breadcrumb(); - if (is_null($breadcrumb)) { + if (!isset($breadcrumb)) { $breadcrumb = menu_get_active_breadcrumb(); } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.383 diff -u -p -r1.383 menu.inc --- includes/menu.inc 26 Mar 2010 17:14:45 -0000 1.383 +++ includes/menu.inc 6 Apr 2010 13:28:44 -0000 @@ -787,12 +787,13 @@ function _menu_link_translate(&$item) { $item['localized_options'] = $item['options']; } else { - $map = explode('/', $item['link_path']); + // Complete the path of the menu link with elements from the current path. + $item['href'] = _menu_fill_wildcards($item['link_path'], arg()); + $map = explode('/', $item['href']); if (!empty($item['to_arg_functions'])) { _menu_link_map_translate($map, $item['to_arg_functions']); + $item['href'] = implode('/', $map); } - $item['href'] = implode('/', $map); - // Note - skip callbacks without real values for their arguments. if (strpos($item['href'], '%') !== FALSE) { $item['access'] = FALSE; @@ -1107,49 +1108,27 @@ function menu_tree_page_data($menu_name, if (!isset($data)) { // Build and run the query, and build the tree. if ($item['access']) { - // Check whether a menu link exists that corresponds to the current path. - $args[] = $item['href']; - if (drupal_is_front_page()) { - $args[] = ''; - } - $parents = db_select('menu_links') - ->fields('menu_links', array( - 'p1', - 'p2', - 'p3', - 'p4', - 'p5', - 'p6', - 'p7', - 'p8', - )) - ->condition('menu_name', $menu_name) - ->condition('link_path', $args, 'IN') - ->execute()->fetchAssoc(); - - if (empty($parents)) { - // If no link exists, we may be on a local task that's not in the links. - // TODO: Handle the case like a local task on a specific node in the menu. - $parents = db_select('menu_links') - ->fields('menu_links', array( - 'p1', - 'p2', - 'p3', - 'p4', - 'p5', - 'p6', - 'p7', - 'p8', - )) - ->condition('menu_name', $menu_name) - ->condition('link_path', $item['tab_root']) - ->execute()->fetchAssoc(); + // Parent mlids. + $parents = array(); + + // Find a menu link corresponding to the current path. + $top_link = menu_link_get_preferred(); + + if ($top_link) { + // Use all the coordinates, except the last one because there + // can be no child beyond the last column. + for ($i = 1; $i < MENU_MAX_DEPTH; $i++) { + if ($top_link['p' . $i]) { + $parents[] = $top_link['p' . $i]; + } + } } + // We always want all the top-level links with plid == 0. $parents[] = '0'; // Use array_values() so that the indices are numeric for array_merge(). - $args = $parents = array_unique(array_values($parents)); + $args = $parents = array_values(array_unique($parents)); $expanded = variable_get('menu_expanded', array()); // Check whether the current menu has any links set to be expanded. if (in_array($menu_name, $expanded)) { @@ -2073,52 +2052,25 @@ function menu_set_active_trail($new_trai elseif (!isset($trail)) { $trail = array(); $trail[] = array('title' => t('Home'), 'href' => '', 'localized_options' => array(), 'type' => 0); - $item = menu_get_item(); - // Check whether the current item is a local task (displayed as a tab). - if ($item['tab_parent']) { - // The title of a local task is used for the tab, never the page title. - // Thus, replace it with the item corresponding to the root path to get - // the relevant href and title. For example, the menu item corresponding - // to 'admin' is used when on the 'By module' tab at 'admin/by-module'. - $parts = explode('/', $item['tab_root']); - $args = arg(); - // Replace wildcards in the root path using the current path. - foreach ($parts as $index => $part) { - if ($part == '%') { - $parts[$index] = $args[$index]; - } - } - // Retrieve the menu item using the root path after wildcard replacement. - $root_item = menu_get_item(implode('/', $parts)); - if ($root_item && $root_item['access']) { - $item = $root_item; - } - } - $menu_names = menu_get_active_menu_names(); - $curr = FALSE; - // Determine if the current page is a link in any of the active menus. - if ($menu_names) { - $query = db_select('menu_links', 'ml'); - $query->fields('ml', array('menu_name')); - $query->condition('ml.link_path', $item['href']); - $query->condition('ml.menu_name', $menu_names, 'IN'); - $result = $query->execute(); - $found = array(); - foreach ($result as $menu) { - $found[] = $menu->menu_name; - } - // The $menu_names array is ordered, so take the first one that matches. - $name = current(array_intersect($menu_names, $found)); - if ($name !== FALSE) { - $tree = menu_tree_page_data($name); + $preferred_link = menu_link_get_preferred(); + + if ($preferred_link) { + $tree = menu_tree_page_data($preferred_link['menu_name']); + if ($router = menu_get_item(_menu_fill_wildcards($preferred_link['link_path'], arg()))) { + $preferred_link += $router; list($key, $curr) = each($tree); } } + else { + $preferred_link = menu_get_item(); + $key = NULL; + $curr = NULL; + } while ($curr) { // Terminate the loop when we find the current path in the active trail. - if ($curr['link']['href'] == $item['href']) { + if ($curr['link']['href'] == $preferred_link['href']) { $trail[] = $curr['link']; $curr = FALSE; } @@ -2131,17 +2083,115 @@ function menu_set_active_trail($new_trai list($key, $curr) = each($tree); } } + // Make sure the current page is in the trail (needed for the page title), // but exclude tabs and the front page. $last = count($trail) - 1; - if ($trail[$last]['href'] != $item['href'] && !(bool)($item['type'] & MENU_IS_LOCAL_TASK) && !drupal_is_front_page()) { - $trail[] = $item; + if ($trail[$last]['href'] != $preferred_link['href'] && !(bool)($preferred_link['type'] & MENU_IS_LOCAL_TASK) && !drupal_is_front_page()) { + $trail[] = $preferred_link; } } return $trail; } /** + * Load the preferred menu link for a given path. + * + * @param $path + * The path, for example node/5. The function will find the corresponding + * menu link (node/5 if it exists, or fallback to node/%). + * @return + * A fully translated menu link, or NULL if not matching menu link was + * found. The most specific menu link (node/5 preferred over node/%) in the + * most preferred menu (as defined by menu_get_active_menu_names()) is returned. + */ +function menu_link_get_preferred($href = NULL, $check_access = TRUE) { + $preferred_links = &drupal_static(__FUNCTION__); + + if (!isset($href)) { + $href = $_GET['q']; + } + + if (!isset($preferred_links[$href])) { + $item = menu_get_item($href); + + // We look for the correct menu link by building a list of candidate + // paths. We pick the most relevant path in the preferred menu. + $path_candidates = array(); + // 1. The current item href. + $path_candidates[] = $item['href']; + // 2. The current item path (with wildcards). + $path_candidates[] = $item['path']; + if ($item['tab_parent']) { + // 3. The href of the current item tab root (if its exists). + $path_candidates[] = _menu_fill_wildcards($item['tab_root'], $item['original_map']); + // 4. The path of the current item tab root (if its exists). + $path_candidates[] = $item['tab_root']; + } + + // The list of preferred menu names, in preference order. + $menu_names = menu_get_active_menu_names(); + + // Build the query. + $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)); + $query->addTag('translatable'); + $query->fields('ml'); + $query->condition('ml.link_path', $path_candidates, 'IN'); + $query->condition('ml.menu_name', $menu_names, 'IN'); + + // Sort candidates by link path and menu name. + $candidates = array(); + foreach ($query->execute() as $candidate) { + $candidates[$candidate['link_path']][$candidate['menu_name']] = $candidate; + } + + // Pick the most specific link, in the preferred menu. + $preferred_links[$href] = NULL; + foreach ($path_candidates as $path) { + if (!isset($candidates[$path])) { + continue; + } + foreach ($menu_names as $menu_name) { + if (!isset($candidates[$path][$menu_name])) { + continue; + } + + $preferred_links[$href] = $candidates[$path][$menu_name]; + break 2; + } + } + } + + return $preferred_links[$href]; +} + +/** + * Replace a path wildcard with elements from a map. + * + * @param $path + * A menu path (ie. 'node/%/edit'). + * @param $map + * A menu map (ie. array('node', '12')). + * @return + * A completed menu path (ie. 'node/12/edit'). + */ +function _menu_fill_wildcards($path, array $map) { + $parts = arg(NULL, $path); + foreach ($parts as $index => $part) { + if (isset($map[$index])) { + if ($part == '%') { + $parts[$index] = $map[$index]; + } + else if ($part != $map[$index]) { + // This path doesn't match from this point forward, abort. + break; + } + } + } + return implode('/', $parts); +} + +/** * Gets the active trail (path to root menu root) of the current page. * * See menu_set_active_trail() for details of return value. Index: modules/field/modules/options/options.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.test,v retrieving revision 1.12 diff -u -p -r1.12 options.test --- modules/field/modules/options/options.test 31 Mar 2010 20:05:06 -0000 1.12 +++ modules/field/modules/options/options.test 6 Apr 2010 13:28:44 -0000 @@ -77,7 +77,7 @@ class OptionsWidgetsTestCase extends Fie field_test_entity_save($entity); // With no field data, no buttons are checked. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoFieldChecked("edit-card-1-$langcode-0"); $this->assertNoFieldChecked("edit-card-1-$langcode-1"); $this->assertNoFieldChecked("edit-card-1-$langcode-2"); @@ -89,7 +89,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0)); // Check that the selected button is checked. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-card-1-$langcode-0"); $this->assertNoFieldChecked("edit-card-1-$langcode-1"); $this->assertNoFieldChecked("edit-card-1-$langcode-2"); @@ -104,7 +104,7 @@ class OptionsWidgetsTestCase extends Fie field_update_field($this->card_1); $instance['required'] = TRUE; field_update_instance($instance); - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-card-1-$langcode-99"); } @@ -134,7 +134,7 @@ class OptionsWidgetsTestCase extends Fie field_test_entity_save($entity); // Display form: with no field data, nothing is checked. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoFieldChecked("edit-card-2-$langcode--0"); $this->assertNoFieldChecked("edit-card-2-$langcode-1"); $this->assertNoFieldChecked("edit-card-2-$langcode-2"); @@ -150,7 +150,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-card-2-$langcode--0"); $this->assertNoFieldChecked("edit-card-2-$langcode-1"); $this->assertFieldChecked("edit-card-2-$langcode-2"); @@ -165,7 +165,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-card-2-$langcode--0"); $this->assertNoFieldChecked("edit-card-2-$langcode-1"); $this->assertNoFieldChecked("edit-card-2-$langcode-2"); @@ -194,7 +194,7 @@ class OptionsWidgetsTestCase extends Fie field_update_field($this->card_2); $instance['required'] = TRUE; field_update_instance($instance); - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-card-2-$langcode-99"); } @@ -221,7 +221,7 @@ class OptionsWidgetsTestCase extends Fie field_test_entity_save($entity); // Display form: with no field data, nothing is selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoOptionSelected("edit-card-1-$langcode", 0); $this->assertNoOptionSelected("edit-card-1-$langcode", 1); $this->assertNoOptionSelected("edit-card-1-$langcode", 2); @@ -233,20 +233,20 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertOptionSelected("edit-card-1-$langcode", 0); $this->assertNoOptionSelected("edit-card-1-$langcode", 1); $this->assertNoOptionSelected("edit-card-1-$langcode", 2); // Submit form: Unselect the option. $edit = array("card_1[$langcode]" => '_none'); - $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $entity->ftid .'/edit', $edit, t('Save')); $this->assertFieldValues($entity_init, 'card_1', $langcode, array()); // A required select list does not have an empty key. $instance['required'] = TRUE; field_update_instance($instance); - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-1-' . $langcode)), t('A required select list does not have an empty key.')); // We do not have to test that a required select list with one option is @@ -261,7 +261,7 @@ class OptionsWidgetsTestCase extends Fie field_update_instance($instance); // Display form: with no field data, nothing is selected - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoOptionSelected("edit-card-1-$langcode", 0); $this->assertNoOptionSelected("edit-card-1-$langcode", 1); $this->assertNoOptionSelected("edit-card-1-$langcode", 2); @@ -274,14 +274,14 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_1', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertOptionSelected("edit-card-1-$langcode", 0); $this->assertNoOptionSelected("edit-card-1-$langcode", 1); $this->assertNoOptionSelected("edit-card-1-$langcode", 2); // Submit form: Unselect the option. $edit = array("card_1[$langcode]" => '_none'); - $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $entity->ftid .'/edit', $edit, t('Save')); $this->assertFieldValues($entity_init, 'card_1', $langcode, array()); } @@ -308,7 +308,7 @@ class OptionsWidgetsTestCase extends Fie field_test_entity_save($entity); // Display form: with no field data, nothing is selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoOptionSelected("edit-card-2-$langcode", 0); $this->assertNoOptionSelected("edit-card-2-$langcode", 1); $this->assertNoOptionSelected("edit-card-2-$langcode", 2); @@ -320,7 +320,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertOptionSelected("edit-card-2-$langcode", 0); $this->assertNoOptionSelected("edit-card-2-$langcode", 1); $this->assertOptionSelected("edit-card-2-$langcode", 2); @@ -331,7 +331,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertOptionSelected("edit-card-2-$langcode", 0); $this->assertNoOptionSelected("edit-card-2-$langcode", 1); $this->assertNoOptionSelected("edit-card-2-$langcode", 2); @@ -351,18 +351,18 @@ class OptionsWidgetsTestCase extends Fie // Check that the 'none' option has no efect if actual options are selected // as well. $edit = array("card_2[$langcode][]" => array('_none' => '_none', 0 => 0)); - $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $entity->ftid .'/edit', $edit, t('Save')); $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0)); // Check that selecting the 'none' option empties the field. $edit = array("card_2[$langcode][]" => array('_none' => '_none')); - $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $entity->ftid .'/edit', $edit, t('Save')); $this->assertFieldValues($entity_init, 'card_2', $langcode, array()); // A required select list does not have an empty key. $instance['required'] = TRUE; field_update_instance($instance); - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), t('A required select list does not have an empty key.')); // We do not have to test that a required select list with one option is @@ -378,7 +378,7 @@ class OptionsWidgetsTestCase extends Fie field_update_instance($instance); // Display form: with no field data, nothing is selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoOptionSelected("edit-card-2-$langcode", 0); $this->assertNoOptionSelected("edit-card-2-$langcode", 1); $this->assertNoOptionSelected("edit-card-2-$langcode", 2); @@ -391,14 +391,14 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'card_2', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertOptionSelected("edit-card-2-$langcode", 0); $this->assertNoOptionSelected("edit-card-2-$langcode", 1); $this->assertNoOptionSelected("edit-card-2-$langcode", 2); // Submit form: Unselect the option. $edit = array("card_2[$langcode][]" => array('_none' => '_none')); - $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $entity->ftid .'/edit', $edit, t('Save')); $this->assertFieldValues($entity_init, 'card_2', $langcode, array()); } @@ -425,7 +425,7 @@ class OptionsWidgetsTestCase extends Fie field_test_entity_save($entity); // Display form: with no field data, option is unchecked. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoFieldChecked("edit-bool-$langcode"); $this->assertRaw('Some dangerous & unescaped markup', t('Option text was properly filtered.')); @@ -435,7 +435,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'bool', $langcode, array(0)); // Display form: check that the right options are selected. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertFieldChecked("edit-bool-$langcode"); // Submit form: uncheck the option. @@ -444,7 +444,7 @@ class OptionsWidgetsTestCase extends Fie $this->assertFieldValues($entity_init, 'bool', $langcode, array(1)); // Display form: with 'off' value, option is unchecked. - $this->drupalGet('test-entity/' . $entity->ftid .'/edit'); + $this->drupalGet('test-entity/manage/' . $entity->ftid .'/edit'); $this->assertNoFieldChecked("edit-bool-$langcode"); } } Index: modules/field/modules/text/text.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v retrieving revision 1.21 diff -u -p -r1.21 text.test --- modules/field/modules/text/text.test 27 Mar 2010 05:52:49 -0000 1.21 +++ modules/field/modules/text/text.test 6 Apr 2010 13:28:44 -0000 @@ -110,7 +110,7 @@ class TextFieldTestCase extends DrupalWe "{$this->field_name}[$langcode][0][value]" => $value, ); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created')); @@ -174,7 +174,7 @@ class TextFieldTestCase extends DrupalWe "{$this->field_name}[$langcode][0][value]" => $value, ); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created')); @@ -200,7 +200,7 @@ class TextFieldTestCase extends DrupalWe // Display edition form. // We should now have a 'text format' selector. - $this->drupalGet('test-entity/' . $id . '/edit'); + $this->drupalGet('test-entity/manage/' . $id . '/edit'); $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed')); $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is displayed')); Index: modules/field/tests/field.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field.test,v retrieving revision 1.26 diff -u -p -r1.26 field.test --- modules/field/tests/field.test 27 Mar 2010 06:03:21 -0000 1.26 +++ modules/field/tests/field.test 6 Apr 2010 13:28:45 -0000 @@ -1469,14 +1469,14 @@ class FieldFormTestCase extends FieldTes $value = mt_rand(1, 127); $edit = array("{$this->field_name}[$langcode][0][value]" => $value); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created'); $entity = field_test_entity_test_load($id); $this->assertEqual($entity->{$this->field_name}[$langcode][0]['value'], $value, 'Field value was saved'); // Display edit form. - $this->drupalGet('test-entity/' . $id . '/edit'); + $this->drupalGet('test-entity/manage/' . $id . '/edit'); $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", $value, 'Widget is displayed with the correct default value'); $this->assertNoField("{$this->field_name}[$langcode][1][value]", 'No extraneous widget is displayed'); @@ -1491,7 +1491,7 @@ class FieldFormTestCase extends FieldTes // Empty the field. $value = ''; $edit = array("{$this->field_name}[$langcode][0][value]" => $value); - $this->drupalPost('test-entity/' . $id . '/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $id . '/edit', $edit, t('Save')); $this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), 'Entity was updated'); $entity = field_test_entity_test_load($id); $this->assertIdentical($entity->{$this->field_name}, array(), 'Field was emptied'); @@ -1516,7 +1516,7 @@ class FieldFormTestCase extends FieldTes $value = mt_rand(1, 127); $edit = array("{$this->field_name}[$langcode][0][value]" => $value); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created'); $entity = field_test_entity_test_load($id); @@ -1525,7 +1525,7 @@ class FieldFormTestCase extends FieldTes // Edit with missing required value. $value = ''; $edit = array("{$this->field_name}[$langcode][0][value]" => $value); - $this->drupalPost('test-entity/' . $id . '/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $id . '/edit', $edit, t('Save')); $this->assertRaw(t('!name field is required.', array('!name' => $this->instance['label'])), 'Required field with no value fails validation'); } @@ -1594,7 +1594,7 @@ class FieldFormTestCase extends FieldTes // Submit the form and create the entity. $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created'); $entity = field_test_entity_test_load($id); @@ -1684,7 +1684,7 @@ class FieldFormTestCase extends FieldTes // Create entity with three values. $edit = array("{$this->field_name}[$langcode]" => '1, 2, 3'); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; // Check that the values were saved. @@ -1692,7 +1692,7 @@ class FieldFormTestCase extends FieldTes $this->assertFieldValues($entity_init, $this->field_name, $langcode, array(1, 2, 3)); // Display the form, check that the values are correctly filled in. - $this->drupalGet('test-entity/' . $id . '/edit'); + $this->drupalGet('test-entity/manage/' . $id . '/edit'); $this->assertFieldByName("{$this->field_name}[$langcode]", '1, 2, 3', t('Widget is displayed.')); // Submit the form with more values than the field accepts. @@ -1739,7 +1739,7 @@ class FieldFormTestCase extends FieldTes // Create entity. $edit = array("{$field_name}[$langcode][0][value]" => 1); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; // Check that the default value was saved. @@ -1749,7 +1749,7 @@ class FieldFormTestCase extends FieldTes // Create a new revision. $edit = array("{$field_name}[$langcode][0][value]" => 2, 'revision' => TRUE); - $this->drupalPost('test-entity/' . $id . '/edit', $edit, t('Save')); + $this->drupalPost('test-entity/manage/' . $id . '/edit', $edit, t('Save')); // Check that the new revision has the expected values. $entity = field_test_entity_test_load($id); Index: modules/field/tests/field_test.entity.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field_test.entity.inc,v retrieving revision 1.7 diff -u -p -r1.7 field_test.entity.inc --- modules/field/tests/field_test.entity.inc 27 Mar 2010 18:41:14 -0000 1.7 +++ modules/field/tests/field_test.entity.inc 6 Apr 2010 13:28:45 -0000 @@ -309,7 +309,7 @@ function field_test_entity_form_submit($ if ($entity->ftid) { unset($form_state['rebuild']); - $form_state['redirect'] = 'test-entity/' . $entity->ftid . '/edit'; + $form_state['redirect'] = 'test-entity/manage/' . $entity->ftid . '/edit'; } else { // Error on save. Index: modules/field/tests/field_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field_test.module,v retrieving revision 1.6 diff -u -p -r1.6 field_test.module --- modules/field/tests/field_test.module 25 Mar 2010 11:46:20 -0000 1.6 +++ modules/field/tests/field_test.module 6 Apr 2010 13:28:45 -0000 @@ -39,7 +39,6 @@ function field_test_permission() { * Implements hook_menu(). */ function field_test_menu() { - $items = array(); $bundles = field_info_bundles('test_entity'); foreach ($bundles as $bundle_name => $bundle_info) { @@ -52,10 +51,10 @@ function field_test_menu() { 'type' => MENU_NORMAL_ITEM, ); } - $items['test-entity/%field_test_entity_test/edit'] = array( + $items['test-entity/manage/%field_test_entity_test/edit'] = array( 'title' => 'Edit test entity', 'page callback' => 'field_test_entity_edit', - 'page arguments' => array(1), + 'page arguments' => array(2), 'access arguments' => array('administer field_test content'), 'type' => MENU_NORMAL_ITEM, ); Index: modules/menu/menu.test =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.test,v retrieving revision 1.34 diff -u -p -r1.34 menu.test --- modules/menu/menu.test 17 Feb 2010 05:46:16 -0000 1.34 +++ modules/menu/menu.test 6 Apr 2010 13:28:45 -0000 @@ -112,14 +112,14 @@ class MenuTestCase extends DrupalWebTest // Assert the new menu. $this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit'); - $this->assertText($title, t('Custom menu was added.')); + $this->assertRaw($title, t('Custom menu was added.')); // Edit the menu. $new_title = $this->randomName(16); $menu['title'] = $new_title; menu_save($menu); $this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit'); - $this->assertText($new_title, t('Custom menu was edited.')); + $this->assertRaw($new_title, t('Custom menu was edited.')); } /** Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.75 diff -u -p -r1.75 taxonomy.test --- modules/taxonomy/taxonomy.test 27 Mar 2010 05:52:50 -0000 1.75 +++ modules/taxonomy/taxonomy.test 6 Apr 2010 13:28:45 -0000 @@ -843,7 +843,7 @@ class TaxonomyTermFieldTestCase extends "{$this->field_name}[$langcode]" => array($term->tid), ); $this->drupalPost(NULL, $edit, t('Save')); - preg_match('|test-entity/(\d+)/edit|', $this->url, $match); + preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));