public function FacetsIntegrationTest::testFacets in Search API Pages 8
Test search api pages.
File
- tests/
src/ Functional/ FacetsIntegrationTest.php, line 72
Class
- FacetsIntegrationTest
- Provides web tests for Search API Pages's integration with facets.
Namespace
Drupal\Tests\search_api_page\FunctionalCode
public function testFacets() {
$page = SearchApiPage::create([
'label' => 'Owl Display',
'id' => 'owl_display',
'index' => $this->index
->id(),
'path' => 'bird_owl',
'show_all_when_no_keys' => TRUE,
]);
$page
->save();
$this
->createFacet('Eurasian Eagle-Owl', 'eagle_owl', 'type', 'owl_display', 'search_api_page');
// Clear the caches because creating a search page is not picked up by the
// routing otherwise.
// @todo: Fix that.
$this
->resetAll();
$this
->drupalGet('bird_owl');
$this
->assertFacetBlocksAppear();
$this
->assertFacetLabel('page');
$this
->assertFacetLabel('article');
$this
->assertSession()
->pageTextContains('60 results found');
$this
->clickPartialLink('page');
$this
->assertSession()
->pageTextContains('11 results found');
}