Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.530 diff -u -9 -p -r1.530 taxonomy.module --- modules/taxonomy/taxonomy.module 24 Oct 2009 05:13:44 -0000 1.530 +++ modules/taxonomy/taxonomy.module 25 Oct 2009 14:15:46 -0000 @@ -53,19 +53,18 @@ function taxonomy_entity_info() { 'bundles' => array(), ), ); foreach (taxonomy_vocabulary_get_names() as $machine_name => $vocabulary) { $return['taxonomy_term']['bundles'][$machine_name] = array( 'label' => $vocabulary->name, 'admin' => array( 'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary', 'real path' => 'admin/structure/taxonomy/' . $vocabulary->vid, - 'bundle argument' => 3, 'access arguments' => array('administer taxonomy'), ), ); } $return['taxonomy_vocabulary'] = array( 'label' => t('Taxonomy vocabulary'), 'controller class' => 'TaxonomyVocabularyController', 'base table' => 'taxonomy_vocabulary', 'object keys' => array( Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.56 diff -u -9 -p -r1.56 taxonomy.test --- modules/taxonomy/taxonomy.test 24 Oct 2009 04:23:51 -0000 1.56 +++ modules/taxonomy/taxonomy.test 25 Oct 2009 14:15:46 -0000 @@ -92,18 +92,61 @@ class TaxonomyVocabularyFunctionalTest e $this->assertText(t('This machine-readable name is already in use by another vocabulary and must be unique.'), t('Duplicate machine name validation was successful')); // Try to submit an invalid machine name. $edit['machine_name'] = '!&^%'; $this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save')); $this->assertText(t('The machine-readable name must contain only lowercase letters, numbers, and underscores.')); } /** + * Test adding term a field via the user interface. + */ + function testFieldInterface() { + $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid); + $this->clickLink(t('Manage fields')); + + // Add a custom field to terms in the vocabulary. + $field_label = $this->randomName(); + $field_name = drupal_strtolower($this->randomName()); + $edit = array( + '_add_new_field[label]' => $field_label, + '_add_new_field[field_name]' => $field_name, + '_add_new_field[type]' => 'text', + '_add_new_field[widget_type]' => 'text_textfield', + ); + $this->drupalPost(NULL, $edit, t('Save')); + + // Accept the default settings. + $this->drupalPost(NULL, array(), t('Save field settings')); + $this->assertRaw(t('Updated field %label field settings', array('%label' => $field_label))); + + // Add a term. + $term_name = $this->randomName(); + $field_value = $this->randomName(); + $edit = array( + 'name' => $term_name, + 'field_' . $field_name . '[' . FIELD_LANGUAGE_NONE . '][0][value]' => $field_value, + ); + $this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list/add', $edit, t('Save')); + $this->assertRaw(t('Created new term %term', array('%term' => $term_name))); + + // Load term list page. + $this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->vid . '/list'); + $this->clickLink($term_name); + + // Load "taxonomy/term/%tid" and verify that the custom field is displayed. + $this->assertRaw(t('There are currently no posts in this category.')); + $this->assertText($term_name); + $this->assertText($field_label); + $this->assertText($field_value); + } + + /** * Changing weights on the vocabulary overview with two or more vocabularies. */ function testTaxonomyAdminChangingWeights() { // Create some vocabularies. for ($i = 0; $i < 10; $i++) { $this->createVocabulary(); } // Get all vocabularies and change their weights. $vocabularies = taxonomy_get_vocabularies();