protected function IntegrationTest::checkResetFacetsProcessor in Facets 8
Tests reset facets processor.
1 call to IntegrationTest::checkResetFacetsProcessor()
- 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 449
Class
- IntegrationTest
- Tests the overall functionality of the Facets summary admin UI.
Namespace
Drupal\Tests\facets_summary\FunctionalCode
protected function checkResetFacetsProcessor() {
// Create new facets summary.
FacetsSummary::create([
'id' => 'reset_facets',
'name' => t('Reset facets 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' => [
'reset_facets' => [
'processor_id' => 'reset_facets',
'weights' => [
'build' => -10,
],
'settings' => [
'link_text' => 'Reset facets',
],
],
],
])
->save();
// Clear the cache after the new facet summary entity was created.
$this
->resetAll();
// Place a block and test reset facets processor.
$blockConfig = [
'label' => 'Reset block',
'region' => 'footer',
'id' => 'reset-facets',
];
$this
->drupalPlaceBlock('facets_summary_block:reset_facets', $blockConfig);
$this
->drupalGet('search-api-test-fulltext');
$this
->assertSession()
->addressEquals('/search-api-test-fulltext');
$this
->assertSession()
->pageTextContains('Displaying 5 search results');
$this
->assertSession()
->pageTextNotContains('Reset facets');
$this
->clickLink('apple');
$this
->assertSession()
->pageTextContains('Displaying 2 search results');
$this
->assertSession()
->pageTextContains('Reset facets');
$this
->clickLink('Reset facets');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->addressEquals('/search-api-test-fulltext');
$this
->assertSession()
->pageTextContains('Displaying 5 search results');
$this
->assertSession()
->pageTextNotContains('Reset facets');
}