You are here

public function AcquiaSearchWebTestCase::testEnvironmentUI in Acquia Search 6.3

Tests that the Acquia Search environment shows up in the interface and that administrators cannot delete it.

Tests executed:

  • Acquia Search environment is present in the UI.
  • Acquia Search is reflected as the default environment in the UI.
  • Admin user receives 403 when attempting to delete the environment.

File

tests/acquia_search.test, line 215

Class

AcquiaSearchWebTestCase
Tests the functionality of the Acquia Search module.

Code

public function testEnvironmentUI() {

  // Enable the Acquia Search environment
  $this
    ->enableEnvironment();

  // Clear the static caches
  $this
    ->clearStaticCache();
  $admin_user = $this
    ->createAdminUser();
  $this
    ->drupalLogin($admin_user);
  $settings_path = 'admin/settings/apachesolr/settings';
  $this
    ->drupalGet($settings_path);
  $this
    ->assertText('Acquia Search', t('The Acquia Search environment is displayed in the UI.'), 'Acquia Search');
  $path = 'admin/settings/apachesolr/settings/' . ACQUIA_SEARCH_ENVIRONMENT_ID . '/edit';
  $options = array(
    'query' => array(
      'destination' => $settings_path,
    ),
  );
  $link = l('Acquia Search', $path, $options);
  $raw = t('!environment <em>(Default)</em>', array(
    '!environment' => $link,
  ));
  $this
    ->assertRaw($raw, t('The Acquia Search environment is reflected as the default in the UI.'), 'Acquia Search');
  $this
    ->drupalGet('admin/config/search/apachesolr/settings/' . ACQUIA_SEARCH_ENVIRONMENT_ID . '/delete');
  $this
    ->assertResponse(403, t('The Acquia Search environment cannot be deleted via the UI.'));
}