You are here

public function AcquiaConnectorSearchTest::testAcquiaSearchServerUi in Acquia Connector 8

Tests Acquia Search Server UI.

Test executed:

  • Check backend server
  • Сheck all fields on the existence of
  • Admin user receives 403 when attempting to delete the server.

File

acquia_search/tests/src/Functional/AcquiaConnectorSearchTest.php, line 184

Class

AcquiaConnectorSearchTest
Tests the functionality of the Acquia Search module.

Namespace

Drupal\Tests\acquia_search\Functional

Code

public function testAcquiaSearchServerUi() {
  $settings_path = 'admin/config/search/search-api';
  $this
    ->drupalGet($settings_path);
  $this
    ->clickLink('Edit', 0);

  // Check backend server.
  $this
    ->assertText('Backend', t('The Backend checkbox label exists'), 'Acquia Search');
  $this
    ->assertFieldChecked('edit-backend-config-connector-solr-acquia-connector', t('Is used as a Solr Connector: Acquia'), 'Acquia Search');

  // Check field Solr server URI.
  $this
    ->assertText('Solr server URI', t('The Solr server URI label exist'), 'Acquia Search');

  // Check http-protocol.
  $this
    ->assertText('HTTP protocol', t('The HTTP protocol label exists'), 'Acquia Search');
  $this
    ->assertOptionSelected('edit-backend-config-connector-config-scheme', 'http', t('By default selected HTTP protocol'), 'Acquia Search');

  // Check Solr host, port, path.
  $this
    ->assertNoText('Solr host', t('The Solr host label does not exist'), 'Acquia Search');
  $this
    ->assertNoText('Solr port', t('The Solr port label does not exist'), 'Acquia Search');
  $this
    ->assertNoText('Solr path', t('The Solr path label does not exist'), 'Acquia Search');

  // Check Basic HTTP authentication.
  $this
    ->assertNoText('Basic HTTP authentication', t('The basic HTTP authentication label does not exist'), 'Acquia Search');

  // Ckeck Solr version override.
  $this
    ->assertText('Solr version override', t('The selectbox "Solr version label" exist'), 'Acquia Search');
  $this
    ->assertOptionByText('edit-backend-config-connector-config-workarounds-solr-version', 'Determine automatically', t('By default selected Solr version "Determine automatically"'), 'Acquia Search');

  // Ckeck HTTP method.
  $this
    ->assertText('HTTP method', t('The HTTP method label exist'));
  $this
    ->assertOptionSelected('edit-backend-config-connector-config-workarounds-http-method', 'AUTO', t('By default selected AUTO HTTP method'), 'Acquia Search');

  // Server save.
  $this
    ->drupalPostForm('/admin/config/search/search-api/server/' . $this->server . '/edit', [], 'Save');

  // Delete server.
  $this
    ->drupalGet('/admin/config/search/search-api/server/' . $this->server . '/delete');
  $this
    ->assertResponse(403, t('The Acquia Search Server cannot be deleted via the UI.'));
}