You are here

protected function IntegrationTest::configureBackendAndSave in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/IntegrationTest.php \Drupal\Tests\search_api_solr\Functional\IntegrationTest::configureBackendAndSave()
  2. 8 tests/src/Functional/IntegrationTest.php \Drupal\Tests\search_api_solr\Functional\IntegrationTest::configureBackendAndSave()
  3. 4.x tests/src/Functional/IntegrationTest.php \Drupal\Tests\search_api_solr\Functional\IntegrationTest::configureBackendAndSave()

Lets derived backend integration tests fill their server create form.

Parameters

array $edit: The common server form values so far.

Overrides IntegrationTest::configureBackendAndSave

File

tests/src/Functional/IntegrationTest.php, line 96

Class

IntegrationTest
Tests the overall functionality of the Search API framework and admin UI.

Namespace

Drupal\Tests\search_api_solr\Functional

Code

protected function configureBackendAndSave(array $edit) {
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('Please configure the selected backend.');
  $edit += [
    'backend_config[connector]' => 'standard',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('Please configure the selected Solr connector.');
  $edit += [
    'backend_config[connector_config][host]' => 'localhost',
    'backend_config[connector_config][port]' => '8983',
    'backend_config[connector_config][path]' => '/',
    'backend_config[connector_config][core]' => '',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('The server was successfully saved.');
  $this
    ->assertSession()
    ->addressEquals('admin/config/search/search-api/server/' . $this->serverId);
  $this
    ->assertSession()
    ->pageTextContains('The Solr server could not be reached or is protected by your service provider.');

  // Go back in and configure Solr.
  $edit_path = 'admin/config/search/search-api/server/' . $this->serverId . '/edit';
  $this
    ->drupalGet($edit_path);
  $edit = [
    'backend_config[connector_config][host]' => 'localhost',
    'backend_config[connector_config][port]' => '8983',
    'backend_config[connector_config][path]' => '/solr',
    'backend_config[connector_config][core]' => 'd8',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('The Solr server could be reached.');
}