You are here

public function ShowTextWhenEmptyProcessorTest::testBuildWithConfigChange in Facets 8

Tests build with config changes.

@covers ::build

File

modules/facets_summary/tests/src/Unit/Plugin/Processor/ShowTextWhenEmptyProcessorTest.php, line 110

Class

ShowTextWhenEmptyProcessorTest
Class ShowTextWhenEmptyProcessorTest.

Namespace

Drupal\Tests\facets_summary\Unit\Plugin\Processor

Code

public function testBuildWithConfigChange() {
  $summary = new FacetsSummary([], 'facets_summary');
  $summary
    ->setFacetSourceId('foo');
  $build = [
    '#items' => [],
  ];
  $this->processor
    ->setConfiguration([
    'text' => [
      'value' => 'Owl',
      'format' => 'llama',
    ],
  ]);
  $result = $this->processor
    ->build($summary, $build, []);
  $this
    ->assertSame('array', gettype($result));
  $this
    ->assertArrayHasKey('#text', $result['#message']);
  $this
    ->assertEquals('Owl', (string) $result['#message']['#text']);
  $this
    ->assertEquals('llama', $result['#message']['#format']);
}