diff --git a/tests/src/Functional/CacheabilityTest.php b/tests/src/Functional/CacheabilityTest.php index edbfbb3b..3bb27282 100644 --- a/tests/src/Functional/CacheabilityTest.php +++ b/tests/src/Functional/CacheabilityTest.php @@ -67,22 +67,22 @@ public function testFramework() { public function testSessionLeak() { $this->drupalLogin($this->adminUser); - // Place the views block in the footer of all pages. + // Place the views block in the first sidebar 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. + // By default, the view should show all 5 entities. $this->drupalGet(''); - $this->assertText('Fulltext test index', 'The search view is shown on the page.'); - $this->assertText('Displaying 5 search results', 'The search view displays the correct number of results.'); + $this->assertSession()->pageTextContains('Fulltext test index'); + $this->assertSession()->pageTextContains('Displaying 5 search results'); // Search for one entity. $this->drupalPostForm(NULL, ['search_api_fulltext' => 'foobuz'], 'Search'); - $this->assertResponse(200); - $this->assertText('Displaying 1 search results'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('Displaying 1 search results'); // Make sure no cookies are sent. $cookie = \Drupal::request()->cookies; @@ -90,21 +90,21 @@ public function testSessionLeak() { // Make the search not required. $view = Views::getView('search_api_test_view'); - $view->setDisplay('page_1'); + $view->setDisplay('block_1'); $filters = $view->display_handler->getOption('filters'); $filters['search_api_fulltext']['expose']['required'] = FALSE; $view->display_handler->setOption('filters', $filters); $view->save(); - // By default, the view should show all entities. + // By default, the view should show all 5 entities. $this->drupalGet(''); - $this->assertText('Fulltext test index', 'The search view is shown on the page.'); - $this->assertText('Displaying 5 search results', 'The search view displays the correct number of results.'); + $this->assertSession()->pageTextContains('Fulltext test index'); + $this->assertSession()->pageTextContains('Displaying 5 search results'); // Search for one entity. $this->drupalPostForm(NULL, ['search_api_fulltext' => 'foobuz'], 'Search'); - $this->assertResponse(200); - $this->assertText('Displaying 1 search results'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('Displaying 1 search results'); // Make sure no cookies are sent. $cookie = \Drupal::request()->cookies;