protected function ExcludeSpecifiedItemsProcessorTest::setUp in Facets 8
Creates a new processor object for use in the tests.
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Plugin/ processor/ ExcludeSpecifiedItemsProcessorTest.php, line 36
Class
- ExcludeSpecifiedItemsProcessorTest
- Unit test for processor.
Namespace
Drupal\Tests\facets\Unit\Plugin\processorCode
protected function setUp() {
parent::setUp();
$facet = new Facet([], 'facets_facet');
$this->originalResults = [
new Result($facet, 'llama', 'llama', 10),
new Result($facet, 'badger', 'badger', 5),
new Result($facet, 'duck', 'duck', 15),
new Result($facet, 'snbke', 'snbke', 10),
new Result($facet, 'snake', 'snake', 10),
new Result($facet, 'snaake', 'snaake', 10),
new Result($facet, 'snaaake', 'snaaake', 10),
new Result($facet, 'snaaaake', 'snaaaake', 10),
new Result($facet, 'snaaaaake', 'snaaaaake', 10),
new Result($facet, 'snaaaaaake', 'snaaaaaake', 10),
];
$processor_id = 'exclude_specified_items';
$this->processor = new ExcludeSpecifiedItemsProcessor([], $processor_id, [
'id' => "display_value_widget_order",
'label' => "Sort by display value",
'description' => "Sorts the widget results by display value.",
'default_enabled' => TRUE,
'stages' => [
"build" => 50,
],
]);
$processor_definitions = [
$processor_id => [
'id' => $processor_id,
'class' => ExcludeSpecifiedItemsProcessor::class,
],
];
$manager = $this
->getMockBuilder(ProcessorPluginManager::class)
->disableOriginalConstructor()
->getMock();
$manager
->expects($this
->any())
->method('getDefinitions')
->willReturn($processor_definitions);
$manager
->expects($this
->any())
->method('createInstance')
->willReturn($this->processor);
$container_builder = new ContainerBuilder();
$container_builder
->set('plugin.manager.facets.processor', $manager);
\Drupal::setContainer($container_builder);
}