You are here

public function HighlightTest::testPostprocessBasicQuery in Search API 8

Makes sure that queries with "basic" processing set are ignored.

File

tests/src/Unit/Processor/HighlightTest.php, line 112

Class

HighlightTest
Tests the "Highlight" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function testPostprocessBasicQuery() {
  $query = $this
    ->createMock(QueryInterface::class);
  $query
    ->expects($this
    ->once())
    ->method('getProcessingLevel')
    ->willReturn(QueryInterface::PROCESSING_BASIC);
  $results = $this
    ->getMockBuilder(ResultSet::class)
    ->setMethods([
    'getResultCount',
    'getQuery',
    'getResultItems',
  ])
    ->setConstructorArgs([
    $query,
  ])
    ->getMock();
  $results
    ->expects($this
    ->once())
    ->method('getResultCount')
    ->willReturn(1);
  $results
    ->expects($this
    ->once())
    ->method('getQuery')
    ->will($this
    ->returnValue($query));
  $results
    ->expects($this
    ->never())
    ->method('getResultItems');

  /** @var \Drupal\search_api\Query\ResultSet $results */
  $this->processor
    ->postprocessSearchResults($results);
}