public function SearchApiSolrTest::searchSuccess in Search API Solr 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::searchSuccess()
- 4.x tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::searchSuccess()
Tests whether some test searches have the correct results.
Overrides BackendTestBase::searchSuccess
File
- tests/
src/ Kernel/ SearchApiSolrTest.php, line 153
Class
- SearchApiSolrTest
- Tests index and search capabilities using the Solr search backend.
Namespace
Drupal\Tests\search_api_solr\KernelCode
public function searchSuccess() {
$this->travisLogger
->debug('SearchApiSolrTest::searchSuccess()');
parent::searchSuccess();
$parse_mode_manager = \Drupal::service('plugin.manager.search_api.parse_mode');
$parse_mode_direct = $parse_mode_manager
->createInstance('direct');
$results = $this
->buildSearch('+test +case', [], [
'body',
])
->setParseMode($parse_mode_direct)
->execute();
$this
->assertResults([
1,
2,
3,
], $results, 'Parse mode direct with AND');
$results = $this
->buildSearch('test -case', [], [
'body',
])
->setParseMode($parse_mode_direct)
->execute();
$this
->assertResults([
4,
], $results, 'Parse mode direct with NOT');
$results = $this
->buildSearch('"test case"', [], [
'body',
])
->setParseMode($parse_mode_direct)
->execute();
$this
->assertResults([
1,
2,
], $results, 'Parse mode direct with phrase');
}