ViewsTest.php in Search API Multilingual Solr Search 8
File
tests/src/Functional/ViewsTest.php
View source
<?php
namespace Drupal\Tests\search_api_solr_multilingual\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\search_api\Entity\Index;
use Drupal\Tests\search_api\Functional\SearchApiBrowserTestBase;
class ViewsTest extends \Drupal\Tests\search_api\Functional\ViewsTest {
public static $modules = array(
'search_api_solr_multilingual_test',
);
public function setUp() {
SearchApiBrowserTestBase::setUp();
ConfigurableLanguage::createFromLangcode('nl')
->save();
$config_factory = \Drupal::configFactory();
$config_factory
->getEditable('search_api.index.database_search_index')
->delete();
$config_factory
->rename('search_api.index.solr_multilingual_search_index', 'search_api.index.database_search_index');
$config_factory
->getEditable('search_api.index.database_search_index')
->set('id', 'database_search_index')
->save();
\Drupal::getContainer()
->get('search_api.index_task_manager')
->addItemsAll(Index::load($this->indexId));
$this
->insertExampleContent();
$this
->indexItems($this->indexId);
}
protected function tearDown() {
$index = Index::load($this->indexId);
$index
->clear();
sleep(2);
parent::tearDown();
}
public function testView() {
$query = [
'language' => [
'***LANGUAGE_language_interface***',
],
];
$this
->checkResults($query, [
1,
2,
3,
4,
5,
], 'Search with interface language as filter');
parent::testView();
}
protected function indexItems($index_id) {
$index_status = parent::indexItems($index_id);
sleep(2);
return $index_status;
}
}
Classes
Name |
Description |
ViewsTest |
Tests the Views integration of the Search API. |