function SearchConfigSettingsForm::testSearchSettingsPage

7.x search.test SearchConfigSettingsForm::testSearchSettingsPage()

Verify the search settings form.

File

drupal-7.x/modules/search/search.test, line 1451
Tests for search.module.

Class

SearchConfigSettingsForm
Test config page.

Code

function testSearchSettingsPage() {

  // Test that the settings form displays the correct count of items left to index.
  $this->drupalGet('admin/config/search/settings');
  $this->assertText(t('There are @count items left to index.', array('@count' => 0)));

  // Test the re-index button.
  $this->drupalPost('admin/config/search/settings', array(), t('Re-index site'));
  $this->assertText(t('Are you sure you want to re-index the site'));
  $this->drupalPost('admin/config/search/settings/reindex', array(), t('Re-index site'));
  $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.');
}