public function IntegrationTest::testBlockView in Facets 8
Tests that a block view also works.
File
- tests/
src/ Functional/ IntegrationTest.php, line 136
Class
- IntegrationTest
- Tests the overall functionality of the Facets admin UI.
Namespace
Drupal\Tests\facets\FunctionalCode
public function testBlockView() {
$facet_id = 'block_view_facet';
$webAssert = $this
->assertSession();
$this
->addFacet('Block view facet', 'type', 'search_api:views_block__search_api_test_view__block_1');
$this
->createBlock($facet_id);
$this
->drupalGet('admin/config/search/facets/' . $facet_id . '/edit');
$webAssert
->checkboxNotChecked('facet_settings[only_visible_when_facet_source_is_visible]');
// Place the views block in the footer of all pages.
$block_settings = [
'region' => 'sidebar_first',
'id' => 'view_block',
];
$this
->drupalPlaceBlock('views_block:search_api_test_view-block_1', $block_settings);
// By default, the view should show all entities.
$this
->drupalGet('<front>');
$webAssert
->pageTextContains('Fulltext test index');
$webAssert
->pageTextContains('Displaying 5 search results');
$webAssert
->pageTextContains('item');
$webAssert
->pageTextContains('article');
// Click the item link, and test that filtering of results actually works.
$this
->clickLink('item');
$webAssert
->pageTextContains('Displaying 3 search results');
}