protected function IntegrationTest::checkShowCountProcessor in Facets 8
Tests show_count processor.
1 call to IntegrationTest::checkShowCountProcessor()
- IntegrationTest::testMultipleFacets in modules/
facets_summary/ tests/ src/ Functional/ IntegrationTest.php - Tests with multiple facets.
File
- modules/
facets_summary/ tests/ src/ Functional/ IntegrationTest.php, line 395
Class
- IntegrationTest
- Tests the overall functionality of the Facets summary admin UI.
Namespace
Drupal\Tests\facets_summary\FunctionalCode
protected function checkShowCountProcessor() {
// Create new facets summary.
FacetsSummary::create([
'id' => 'show_count',
'name' => 'Show count summary',
'facet_source_id' => 'search_api:views_page__search_api_test_view__page_1',
'facets' => [
'giraffe' => [
'checked' => 1,
'label' => 'Giraffe',
'separator' => ',',
'weight' => 0,
'show_count' => 0,
],
'llama' => [
'checked' => 1,
'label' => 'Llama',
'separator' => ',',
'weight' => 0,
'show_count' => 0,
],
],
'processor_configs' => [
'show_count' => [
'processor_id' => 'show_count',
'weights' => [
'build' => -10,
],
],
],
])
->save();
// Clear the cache after the new facet summary entity was created.
$this
->resetAll();
// Place a block and test show_count processor.
$blockConfig = [
'region' => 'footer',
'id' => 'show-count',
'label' => 'show-count-block',
];
$this
->drupalPlaceBlock('facets_summary_block:show_count', $blockConfig);
$this
->drupalGet('search-api-test-fulltext');
$this
->assertSession()
->pageTextContains('5 results found');
$this
->clickLink('apple');
$this
->assertSession()
->pageTextContains('2 results found');
$this
->clickLink('item');
$this
->assertSession()
->pageTextContains('1 result found');
}