You are here

function DrupalSolrOfflineSearchPagesWebTestCase::testEditSearchPage in Apache Solr Search 7

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

Asserts that we can edit a search environment

File

tests/apachesolr_base.test, line 303
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/config/search/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);

  // Make sure the menu is recognized
  drupal_static_reset('apachesolr_search_load_all_search_pages');
  menu_cache_clear_all();
  menu_rebuild();
  $this
    ->drupalGet('admin/config/search/apachesolr/search-pages');
  $this
    ->assertText(t('Test Search Page'), t('Search page was successfully edited'));
  $this
    ->assertText('search/searchdifferentpath', t('Search path was updated'));
  $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'));
}