You are here

function DrupalSolrOfflineSearchPagesWebTestCase::testEditSearchPage in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 tests/apachesolr_base.test \DrupalSolrOfflineSearchPagesWebTestCase::testEditSearchPage()
  2. 7 tests/apachesolr_base.test \DrupalSolrOfflineSearchPagesWebTestCase::testEditSearchPage()

Asserts that we can edit a search environment

File

tests/apachesolr_base.test, line 323
Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server

Class

DrupalSolrOfflineSearchPagesWebTestCase
@file Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server

Code

function testEditSearchPage() {
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('admin/settings/apachesolr/search-pages');
  $this
    ->clickLink(t('Edit'));
  $this
    ->assertText(t('The human-readable name of the search page configuration'), t('Edit page was successfully loaded'));
  $edit = array(
    'label' => 'Test Search Page',
    'description' => 'Test Description',
    'page_title' => 'Test Title',
    'search_path' => 'search/searchdifferentpath',
  );
  $this
    ->drupalPost($this
    ->getUrl(), $edit, t('Save'));
  $this
    ->assertResponse(200);

  // Reset static var
  apachesolr_search_page_load('core_search', TRUE);
  $this
    ->drupalGet('admin/settings/apachesolr/search-pages');
  $this
    ->assertText(t('Test Search Page'), t('Search page was successfully edited'));
  $this
    ->assertText('search/searchdifferentpath', t('Search path was updated'));

  // Reset static var
  $search_page = apachesolr_search_page_load('core_search', TRUE);
  cache_clear_all();
  menu_rebuild();
  $this
    ->drupalGet('search/searchdifferentpath');
  $this
    ->assertText(t('Search is temporarily unavailable. If the problem persists, please contact the site administrator.'), t('Search path was successfully created and is accessible'));
}