public function TranslateEntityProcessorTest::testDeletedEntityResults in Facets 8
Test that deleted entities still in index results doesn't display.
@dataProvider facetDataProvider
Parameters
\Drupal\facets\FacetInterface $facet: A facet mock.
array $results: The facet original results mock.
File
- tests/
src/ Unit/ Plugin/ processor/ TranslateEntityProcessorTest.php, line 236
Class
- TranslateEntityProcessorTest
- Unit test for processor.
Namespace
Drupal\Tests\facets\Unit\Plugin\processorCode
public function testDeletedEntityResults(FacetInterface $facet, array $results) {
// Set original results.
$term_storage = $this
->createMock(EntityStorageInterface::class);
$term_storage
->expects($this
->any())
->method('loadMultiple')
->willReturn([]);
$this->entityTypeManager
->expects($this
->exactly(1))
->method('getStorage')
->willReturn($term_storage);
// Processor should return nothing (and not throw an exception).
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
$processor = new TranslateEntityProcessor([], 'translate_entity', [], $this->languageManager, $this->entityTypeManager);
$filtered_results = $processor
->build($facet, $results);
$this
->assertEmpty($filtered_results);
}