public function RoleFilterTest::testFilterInclusive in Search API 8
Tests preprocessing search items with an inclusive filter.
File
- tests/
src/ Unit/ Processor/ RoleFilterTest.php, line 98
Class
- RoleFilterTest
- Tests the "Role filter" processor.
Namespace
Drupal\Tests\search_api\Unit\ProcessorCode
public function testFilterInclusive() {
$configuration['roles'] = [
'authenticated',
];
$configuration['default'] = 0;
$this->processor
->setConfiguration($configuration);
$this->processor
->alterIndexedItems($this->items);
$this
->assertTrue(!empty($this->items[Utility::createCombinedId('entity:user', '1:en')]), 'User with two roles was not removed.');
$this
->assertTrue(!empty($this->items[Utility::createCombinedId('entity:user', '2:en')]), 'User with only the authenticated role was not removed.');
$this
->assertTrue(!empty($this->items[Utility::createCombinedId('entity:node', '1:en')]), 'Node item was not removed.');
}