public function SearchApiSolrTest::testConfigGeneration in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::testConfigGeneration()
- 4.x tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::testConfigGeneration()
Test generation of Solr configuration files.
@dataProvider configGenerationDataProvider
File
- tests/
src/ Kernel/ SearchApiSolrTest.php, line 942
Class
- SearchApiSolrTest
- Tests index and search capabilities using the Solr search backend.
Namespace
Drupal\Tests\search_api_solr\KernelCode
public function testConfigGeneration(string $language, array $files) {
$server = $this
->getServer();
$backend_config = $server
->getBackendConfig();
/** @var \Drupal\search_api_solr\Controller\SolrFieldTypeListBuilder $list_builder */
$list_builder = \Drupal::entityTypeManager()
->getListBuilder('solr_field_type');
$list_builder
->setServer($server);
$config_files = $list_builder
->getConfigFiles();
foreach ($files as $file_name => $expected_strings) {
$this
->assertArrayHasKey($file_name, $config_files);
foreach ($expected_strings as $string) {
$this
->assertContains($string, $config_files[$file_name]);
}
}
$this
->assertContains($server
->id(), $config_files['test.txt']);
$this
->assertNotContains('<jmx />', $config_files['solrconfig_extra.xml']);
$backend_config['connector_config']['jmx'] = TRUE;
$server
->setBackendConfig($backend_config);
$server
->save();
$config_files = $list_builder
->getConfigFiles();
$this
->assertContains('<jmx />', $config_files['solrconfig_extra.xml']);
}