You are here

public function NodeExcludeTest::testSupportsIndex in Search API exclude 8

Tests whether supportsIndex() returns TRUE for an index containing nodes.

@dataProvider supportsIndexDataProvider

Parameters

string[]|null $datasource_ids: The IDs of datasources the index should have, or NULL if it should have all of them.

bool $expected: Whether the processor is supposed to support that index.

File

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

Class

NodeExcludeTest
Tests the "Node exclude" processor.

Namespace

Drupal\Tests\search_api_exclude\Unit\Plugin\Processor

Code

public function testSupportsIndex(array $datasource_ids = NULL, $expected) {
  if ($datasource_ids !== NULL) {
    $datasource_ids = array_flip($datasource_ids);
    $this->datasources = array_intersect_key($this->datasources, $datasource_ids);
  }
  $this->index
    ->method('getDatasources')
    ->will($this
    ->returnValue($this->datasources));
  $this
    ->assertEquals($expected, NodeExclude::supportsIndex($this->index));
}