You are here

function DrupalSolrOfflineEnvironmentWebTestCase::testEditSearchEnvironmentURLs in Apache Solr Search 7

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

Asserts that we can use various url forms for the search environment

File

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

Class

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

Code

function testEditSearchEnvironmentURLs() {

  // Set the various url schemes that will be tested
  $urls = array(
    'http://user@localhost:8983/solr/core_does_not_exists',
    'http://user:pass@localhost:8983/solr/core_does_not_exists',
    'http://user:pass@localhost/solr/core_does_not_exists',
    'https://localhost:8983/solr/core_does_not_exists',
  );
  $this
    ->drupalLogin($this->admin_user);
  foreach ($urls as $url) {
    $this
      ->drupalGet('admin/config/search/apachesolr/settings');
    $this
      ->clickLink(t('Edit'));
    $this
      ->assertText(t('Example: http://localhost:8983/solr'), t('Edit page was successfully loaded'));
    $edit = array(
      'url' => $url,
    );
    $this
      ->drupalPost($this
      ->getUrl(), $edit, t('Save'));
    $this
      ->assertResponse(200);
    $this
      ->drupalGet('admin/config/search/apachesolr/settings');
    $this
      ->assertText($url, t('Search environment url was successfully set to !url', array(
      '!url' => $url,
    )));
  }
}