You are here

function GoogleMiniTest::setUp in Google Search Appliance 6.2

Same name and namespace in other branches
  1. 5 tests/googlemini.test \GoogleMiniTest::setUp()

File

tests/googlemini.test, line 13

Class

GoogleMiniTest

Code

function setUp() {
  $dir = drupal_get_path('module', 'google_appliance');
  include_once $dir . '/DrupalGoogleMini.php';
  $this->stockMini = new DrupalGoogleMini();
  $this->stockMini
    ->setOutputEncoding('utf8');
  $this->stockMini
    ->setInputEncoding('utf8');
  $this->stockMini
    ->setMetaDataRequested('*');

  // get configuration from settings page
  $_tmp_host = variable_get('google_appliance_host_name', false);
  if (!$_tmp_host) {
    drupal_set_message(t('No host name has been configured for the search appliance. Please enter it on the <a href="@admin-url">Google Appliance settings page</a>', array(
      "@admin-url" => url("admin/settings/search/google_appliance"),
    )), 'error');
    return false;
  }
  $this->stockMini->baseUrl = $_tmp_host . "/search";
  $this->stockMini->collection = variable_get('google_appliance_collection', '');
  $this->stockMini
    ->setQueryPart('client', variable_get('google_appliance_client', ''));
}