public function ShowTextWhenEmptyProcessorTest::testBuildWithEmptyItems in Facets 8
Tests the build method.
@covers ::build
File
- modules/
facets_summary/ tests/ src/ Unit/ Plugin/ Processor/ ShowTextWhenEmptyProcessorTest.php, line 90
Class
- ShowTextWhenEmptyProcessorTest
- Class ShowTextWhenEmptyProcessorTest.
Namespace
Drupal\Tests\facets_summary\Unit\Plugin\ProcessorCode
public function testBuildWithEmptyItems() {
$summary = new FacetsSummary([], 'facets_summary');
$summary
->setFacetSourceId('foo');
$build = [
'#items' => [],
];
$result = $this->processor
->build($summary, $build, []);
$this
->assertSame('array', gettype($result));
$this
->assertArrayHasKey('#theme', $result);
$this
->assertEquals('facets_summary_empty', $result['#theme']);
$this
->assertArrayHasKey('#message', $result);
$this
->assertArrayHasKey('#text', $result['#message']);
$this
->assertEquals(new TranslatableMarkup('No results found.'), (string) $result['#message']['#text']);
$this
->assertEquals('plain_text', $result['#message']['#format']);
}