diff --git a/modules/field/field.attach.inc b/modules/field/field.attach.inc index 267be93..8b1688c 100644 --- a/modules/field/field.attach.inc +++ b/modules/field/field.attach.inc @@ -1336,6 +1336,7 @@ function field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { // Clear the cache. field_cache_clear(); + entity_info_cache_clear(); // Update bundle settings. $settings = variable_get('field_bundle_settings_' . $entity_type . '__' . $bundle_old, array()); diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module index 5f8bc45..284bc4e 100644 --- a/modules/field_ui/field_ui.module +++ b/modules/field_ui/field_ui.module @@ -51,9 +51,7 @@ function field_ui_help($path, $arg) { */ function field_ui_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { // The Field UI relies on entity_get_info() to build menu items for entity - // field administration pages. Clear the entity info cache and ensure that - // the menu is rebuilt. - entity_info_cache_clear(); + // field administration pages. Ensure that the menu is rebuilt. menu_rebuild(); } diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test index b67b70e..e8640a4 100644 --- a/modules/field_ui/field_ui.test +++ b/modules/field_ui/field_ui.test @@ -18,7 +18,9 @@ class FieldUITestCase extends DrupalWebTestCase { if (isset($modules[0]) && is_array($modules[0])) { $modules = $modules[0]; } + $modules[] = 'field_ui'; $modules[] = 'field_test'; + $modules[] = 'taxonomy'; parent::setUp($modules); // Create test user. @@ -134,6 +136,8 @@ class FieldUITestCase extends DrupalWebTestCase { * Tests the functionality of the 'Manage fields' screen. */ class FieldUIManageFieldsTestCase extends FieldUITestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( 'name' => 'Manage fields', @@ -149,6 +153,31 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase { $this->field_label = $this->randomName(8); $this->field_name_input = strtolower($this->randomName(8)); $this->field_name = 'field_'. $this->field_name_input; + + // Create Basic page and Article node types. + $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); + $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); + + // Create a vocabulary named "Tags". + $vocabulary = (object) array( + 'name' => 'Tags', + 'machine_name' => 'tags', + ); + taxonomy_vocabulary_save($vocabulary); + + $field = array( + 'field_name' => 'field_' . $vocabulary->machine_name, + 'type' => 'taxonomy_term_reference', + ); + field_create_field($field); + + $instance = array( + 'field_name' => 'field_' . $vocabulary->machine_name, + 'entity_type' => 'node', + 'label' => 'Tags', + 'bundle' => 'article', + ); + field_create_instance($instance); } /** @@ -166,9 +195,13 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase { /** * Tests the manage fields page. + * + * @param string $type + * (optional) The name of a content type. */ - function manageFieldsPage() { - $this->drupalGet('admin/structure/types/manage/' . $this->hyphen_type . '/fields'); + function manageFieldsPage($type = '') { + $type = empty($type) ? $this->type : $type; + $this->drupalGet('admin/structure/types/manage/' . $type . '/fields'); // Check all table columns. $table_headers = array( t('Label'), @@ -423,8 +456,7 @@ class FieldUIManageFieldsTestCase extends FieldUITestCase { 'type' => $type2, ); $this->drupalPost('admin/structure/types/manage/' . $this->hyphen_type, $options, t('Save content type')); - - $this->drupalGet('admin/structure/types/manage/' . $hyphen_type2 . '/fields'); + $this->manageFieldsPage($type2); } /** diff --git a/modules/node/node.module b/modules/node/node.module index 3c65b62..57e2bb8 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -217,6 +217,7 @@ function node_entity_info() { // Bundles must provide a human readable name so we can create help and error // messages, and the path to attach Field admin pages to. + node_type_cache_reset(); foreach (node_type_get_names() as $type => $name) { $return['node']['bundles'][$type] = array( 'label' => $name,