You are here

public function AcquiaConnectorSearchTest::testAcquiaSearchIndexUi in Acquia Connector 8

Tests Acquia Search Server UI.

Test executed:

  • Сheck all fields on the existence of
  • Check fields used for indexing
  • Check save index
  • Admin user receives 403 when attempting to delete the index.

File

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

Class

AcquiaConnectorSearchTest
Tests the functionality of the Acquia Search module.

Namespace

Drupal\Tests\acquia_search\Functional

Code

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

  // Check field data types.
  $this
    ->assertText('Datasources', t('The Data types label exist'), 'Acquia Search');

  // Check default selected server.
  $this
    ->assertFieldChecked('edit-server-acquia-search-server', t('By default selected Acquia Search Server'), 'Acquia Search');

  // Check fields used for indexing.
  $this
    ->drupalGet('/admin/config/search/search-api/index/' . $this->index . '/fields');
  $this
    ->assertOptionSelected('edit-fields-body-type', 'text', t('Body used for searching'), t('Acquia Search'));
  $this
    ->assertOptionSelected('edit-fields-title-type', 'text', t('Title used for searching'), 'Acquia Search');

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

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