You are here

protected function NodeExcludeTest::setUp in Search API exclude 8

Creates a new processor object for use in the tests.

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/Processor/NodeExcludeTest.php, line 54

Class

NodeExcludeTest
Tests the "Node exclude" processor.

Namespace

Drupal\Tests\search_api_exclude\Unit\Plugin\Processor

Code

protected function setUp() {
  parent::setUp();

  // Include system.module in order to load some required constants.
  require_once sprintf('%s/core/modules/system/system.module', $this->root);
  $this
    ->setUpMockContainer();
  $this->processor = new NodeExclude([], 'node_exclude', []);
  $this->index = $this
    ->createMock(IndexInterface::class);
  foreach ([
    'node',
    'comment',
    'user',
  ] as $entity_type) {
    $datasource = $this
      ->createMock(DatasourceInterface::class);
    $datasource
      ->expects($this
      ->any())
      ->method('getEntityTypeId')
      ->will($this
      ->returnValue($entity_type));
    $this->datasources[sprintf('entity:%s', $entity_type)] = $datasource;
  }
}