IntegrationTest.php in Search API Solr 8
File
tests/src/Functional/IntegrationTest.php
View source
<?php
namespace Drupal\Tests\search_api_solr\Functional;
class IntegrationTest extends \Drupal\Tests\search_api\Functional\IntegrationTest {
protected $serverBackend = 'search_api_solr';
public static $modules = array(
'search_api_solr',
'search_api_solr_test',
);
protected function tearDown() {
if ($this->indexId) {
if ($index = $this
->getIndex()) {
$index
->clear();
sleep(2);
}
}
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]' => 'drupal',
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('The Solr server could be reached.');
}
protected function indexItems() {
$index_status = parent::indexItems();
sleep(2);
return $index_status;
}
}
Classes
Name |
Description |
IntegrationTest |
Tests the overall functionality of the Search API framework and admin UI. |