public function SearchApiGranularTest::testEmptyResults in Facets 8
Tests string query type without results.
File
- tests/
src/ Unit/ Plugin/ query_type/ SearchApiGranularTest.php, line 115
Class
- SearchApiGranularTest
- Unit test for granular query type.
Namespace
Drupal\Tests\facets\Unit\Plugin\query_typeCode
public function testEmptyResults() {
$query = new SearchApiQuery([], 'search_api_query', []);
$facet = new Facet([], 'facets_facet');
$query_type = new SearchApiGranular([
'facet' => $facet,
'query' => $query,
], 'search_api_string', []);
$built_facet = $query_type
->build();
$this
->assertInstanceOf(FacetInterface::class, $built_facet);
$results = $built_facet
->getResults();
$this
->assertSame('array', gettype($results));
$this
->assertEmpty($results);
}