You are here

public function SearchApiGranularTest::setUp in Facets 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/query_type/SearchApiGranularTest.php, line 29

Class

SearchApiGranularTest
Unit test for granular query type.

Namespace

Drupal\Tests\facets\Unit\Plugin\query_type

Code

public function setUp() {
  parent::setUp();
  $processor_id = 'granularity_item';
  $processor_definitions = [
    $processor_id => [
      'id' => $processor_id,
      'class' => GranularItemProcessor::class,
    ],
  ];
  $granularityProcessor = new GranularItemProcessor([
    'granularity' => 10,
  ], 'granularity_item', []);
  $processor_manager = $this
    ->prophesize(ProcessorPluginManager::class);
  $processor_manager
    ->getDefinitions()
    ->willReturn($processor_definitions);
  $processor_manager
    ->createInstance('granularity_item', Argument::any())
    ->willReturn($granularityProcessor);
  $container = new ContainerBuilder();
  $container
    ->set('plugin.manager.facets.processor', $processor_manager
    ->reveal());
  \Drupal::setContainer($container);
}