You are here

public function AcquiaSearchWebTestCase::testDefaultSearch in Acquia Connector 7.2

Same name and namespace in other branches
  1. 7.3 acquia_search/tests/acquia_search.test \AcquiaSearchWebTestCase::testDefaultSearch()

Tests that Apache Solr search is set as the default search when the Acquia Search environment is enabled.

Tests executed:

  • The "search_default_module" variable is set to "apachesolr_search".
  • Executing a search via the core search block redirects to search/site.

File

acquia_search/tests/acquia_search.test, line 536
Tests for the Acquia Search module.

Class

AcquiaSearchWebTestCase
Tests the functionality of the Acquia Search module.

Code

public function testDefaultSearch() {
  $this
    ->enableAcquiaSearchEnvironment();

  // Test that the default search variable is set to the expected value.
  $default_search = variable_get('search_default_module', 'node');
  $this
    ->assertEqual('apachesolr_search', $default_search, t('The default search is set to Apache Solr search when the Acquia Search environment is created.'), 'Acquia Search');

  // Visit the homepage and execute a search through the core search block. It
  // should redirect to "search/site/test" if working properly.
  $authenticated_user = $this
    ->createAuthenticatedUser();
  $this
    ->drupalLogin($authenticated_user);
  $edit = array(
    'search_block_form' => 'test',
  );
  $this
    ->drupalPost('', $edit, t('Search'));
  $this
    ->assertUrl('search/site/test', array(), t('The core search block redirects to the Apache Solr search page.'), 'Acquia Search');
}