You are here

public function SearchApiStringTest::testEmptyResults in Facets 8

Tests string query type without results.

File

tests/src/Unit/Plugin/query_type/SearchApiStringTest.php, line 103

Class

SearchApiStringTest
Unit test for query type.

Namespace

Drupal\Tests\facets\Unit\Plugin\query_type

Code

public function testEmptyResults() {
  $query = new SearchApiQuery([], 'search_api_query', []);
  $facet = new Facet([], 'facets_facet');
  $query_type = new SearchApiString([
    '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);
}