You are here

public function HideOnlyOneItemProcessorTest::testWithOneActiveResult in Facets 8

Tests with one result that is already active.

@covers ::build

File

tests/src/Unit/Plugin/processor/HideOnlyOneItemProcessorTest.php, line 41

Class

HideOnlyOneItemProcessorTest
Class HideOnlyOneItemProcessorTest.

Namespace

Drupal\Tests\facets\Unit\Plugin\processor

Code

public function testWithOneActiveResult() {
  $processor = new HideOnlyOneItemProcessor([], 'hide_only_one_item', []);
  $facet = new Facet([], 'facets_facet');
  $results = [
    new Result($facet, '1', 1, 1),
  ];
  $results[0]
    ->setActiveState(TRUE);
  $facet = $this
    ->getMockBuilder(Facet::class)
    ->disableOriginalConstructor()
    ->getMock();
  $processed_results = $processor
    ->build($facet, $results);
  $this
    ->assertCount(1, $processed_results);
}