You are here

protected function HighlightTest::setUp in Search API 8

Creates a new processor object for use in the tests.

Overrides UnitTestCase::setUp

File

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

Class

HighlightTest
Tests the "Highlight" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

protected function setUp() {
  parent::setUp();
  $this
    ->setUpMockContainer();
  $this->processor = new Highlight([], 'highlight', []);
  $this->index = $this
    ->createMock(IndexInterface::class);
  $this->index
    ->expects($this
    ->any())
    ->method('getFulltextFields')
    ->willReturn([
    'body',
    'title',
  ]);
  $this->processor
    ->setIndex($this->index);

  /** @var \Drupal\Core\StringTranslation\TranslationInterface $translation */
  $translation = $this
    ->getStringTranslationStub();
  $this->processor
    ->setStringTranslation($translation);
}