From 9afbc13d6bb62ee93e4ceabc6d9e22b61dcd7e91 Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 28 Apr 2012 23:20:21 -0700 Subject: Issue #1527988 by Niklas Fiekas: Fixed Missing or legacy number validation. --- modules/search/search.admin.inc | 3 ++- modules/search/search.test | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/search') diff --git a/modules/search/search.admin.inc b/modules/search/search.admin.inc index fda14ee7b..a609485ac 100644 --- a/modules/search/search.admin.inc +++ b/modules/search/search.admin.inc @@ -95,7 +95,8 @@ function search_admin_settings($form) { '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, - '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).') + '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'), + '#element_validate' => array('element_validate_integer_positive'), ); $form['indexing_settings']['overlap_cjk'] = array( '#type' => 'checkbox', diff --git a/modules/search/search.test b/modules/search/search.test index 26c663e71..eeb6bf21b 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -1461,6 +1461,17 @@ class SearchConfigSettingsForm extends DrupalWebTestCase { $this->assertText(t('The index will be rebuilt')); $this->drupalGet('admin/config/search/settings'); $this->assertText(t('There is 1 item left to index.')); + + // Test that the form saves with the default values. + $this->drupalPost('admin/config/search/settings', array(), t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), 'Form saves with the default values.'); + + // Test that the form does not save with an invalid word length. + $edit = array( + 'minimum_word_size' => $this->randomName(3), + ); + $this->drupalPost('admin/config/search/settings', $edit, t('Save configuration')); + $this->assertNoText(t('The configuration options have been saved.'), 'Form does not save with an invalid word length.'); } /** -- cgit v1.2.3