commit d6589791f83d14566e31c77d725e317a3e3d0d80 Author: Andy Postnikov Date: Tue Sep 25 08:05:59 2012 +0700 Fixed forum tests diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index ce85456..6923012 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -586,7 +586,8 @@ function forum_field_storage_pre_update($entity_type, $entity, &$skip_fields) { */ function forum_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_id) { $vid = config('forum.settings')->get('vocabulary'); - if (isset($form['vid']['#value']) && $form['vid']['#value'] == $vid) { + $vocabulary = $form_state['controller']->getEntity($form_state); + if (!$vocabulary->isNew() && $vid == $vocabulary->vid) { $form['help_forum_vocab'] = array( '#markup' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'), '#weight' => -1, @@ -597,6 +598,8 @@ function forum_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_i $form['hierarchy']['#value'] = TAXONOMY_HIERARCHY_SINGLE; // Do not allow to delete forum's vocabulary. $form['actions']['delete']['#access'] = FALSE; + // Do not allow to change a vid of forum's vocabulary. + $form['vid']['#disabled'] = TRUE; } } diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 3fc9066..e44b659 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -343,11 +343,12 @@ class ForumTest extends WebTestBase { // Generate a random name/description. $title = $this->randomName(10); $description = $this->randomName(100); + // @todo check that no vid field availiable. + $new_vid = drupal_strtolower(drupal_substr($this->randomName(), 3, 9)); $edit = array( 'name' => $title, 'description' => $description, - 'vid' => drupal_strtolower(drupal_substr($this->randomName(), 3, 9)), ); // Edit the vocabulary.