public function IntegrationTest::testViewsCacheDisable in Facets 8
Same name in this branch
- 8 tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets\Functional\IntegrationTest::testViewsCacheDisable()
- 8 modules/facets_summary/tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets_summary\Functional\IntegrationTest::testViewsCacheDisable()
Check that the disabling of the cache works.
File
- modules/
facets_summary/ tests/ src/ Functional/ IntegrationTest.php, line 227
Class
- IntegrationTest
- Tests the overall functionality of the Facets summary admin UI.
Namespace
Drupal\Tests\facets_summary\FunctionalCode
public function testViewsCacheDisable() {
// Load the view, verify cache settings.
$view = Views::getView('search_api_test_view');
$view
->setDisplay('page_1');
$current_cache = $view->display_handler
->getOption('cache');
$this
->assertEquals('none', $current_cache['type']);
$view->display_handler
->setOption('cache', [
'type' => 'tag',
]);
$view
->save();
$current_cache = $view->display_handler
->getOption('cache');
$this
->assertEquals('tag', $current_cache['type']);
// Create a facet and check for the cache disabled message.
$id = "western_screech_owl";
$name = "Western screech owl";
$values = [
'name' => $name,
'id' => $id,
'facet_source_id' => 'search_api:views_page__search_api_test_view__page_1',
];
$this
->drupalPostForm('admin/config/search/facets/add-facet-summary', $values, 'Save');
$this
->assertSession()
->pageTextContains('Caching of view Search API Test Fulltext search view has been disabled.');
// Check the view's cache settings again to see if they've been updated.
$view = Views::getView('search_api_test_view');
$view
->setDisplay('page_1');
$current_cache = $view->display_handler
->getOption('cache');
$this
->assertEquals('none', $current_cache['type']);
}