IntegrationTest.php in Search API Solr 8.3
File
tests/src/Functional/IntegrationTest.php
View source
<?php
namespace Drupal\Tests\search_api_solr\Functional;
use Drupal\search_api\Entity\Index;
use Drupal\search_api_solr\Utility\SolrCommitTrait;
use Drupal\Tests\search_api\Functional\IntegrationTest as SearchApiIntegrationTest;
class IntegrationTest extends SearchApiIntegrationTest {
use SolrCommitTrait;
protected $serverBackend = 'search_api_solr';
public static $modules = [
'search_api_solr',
'search_api_solr_test',
];
protected function tearDown() {
if ($this->indexId) {
if ($index = $this
->getIndex()) {
$index
->clear();
$this
->ensureCommit($index);
}
}
parent::tearDown();
}
public function testFramework() {
$this
->createServer();
$this
->createServerDuplicate();
$this
->createIndex();
$this
->createIndexDuplicate();
$this
->editServer();
$this
->editIndex();
$this
->checkUserIndexCreation();
$this
->checkFieldLabels();
$this
->setReadOnly();
$this
->changeIndexDatasource();
$this
->changeIndexServer();
}
public function testIntegerIndex() {
}
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]' => '/foo',
'backend_config[connector_config][core]' => 'bar',
];
$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.');
$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]' => '/',
'backend_config[connector_config][core]' => 'd8',
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('The Solr server could be reached.');
}
protected function indexItems() {
$index_status = parent::indexItems();
$index = Index::load($this->indexId);
$this
->ensureCommit($index);
return $index_status;
}
}
Classes
Name |
Description |
IntegrationTest |
Tests the overall functionality of the Search API framework and admin UI. |