protected function PagesIntegrationTest::enableSearch in Search API Autocomplete 8
Enables the search.
1 call to PagesIntegrationTest::enableSearch()
- PagesIntegrationTest::testModule in tests/
src/ FunctionalJavascript/ PagesIntegrationTest.php - Tests autocomplete for search pages.
File
- tests/
src/ FunctionalJavascript/ PagesIntegrationTest.php, line 91
Class
- PagesIntegrationTest
- Tests integration with the Search API Pages module.
Namespace
Drupal\Tests\search_api_autocomplete\FunctionalJavascriptCode
protected function enableSearch() {
$assert_session = $this
->assertSession();
$this
->drupalGet($this
->getAdminPath());
// Check whether all expected groups and searches are present.
$assert_session
->pageTextContains('Search pages');
$assert_session
->pageTextContains('Searches provided by the Search pages module');
$assert_session
->pageTextContains('Test search page');
// Enable autocomplete for all search pages (just one).
$assert_session
->checkboxNotChecked("searches[{$this->searchId}]");
$this
->click('table[data-drupal-selector="edit-search-pages-searches"] > thead > tr > th.select-all input.form-checkbox');
$assert_session
->checkboxChecked("searches[{$this->searchId}]");
// Save the settings.
$this
->click('[data-drupal-selector="edit-actions-submit"]');
$this
->logPageChange(NULL, 'POST');
$assert_session
->pageTextContains('The settings have been saved.');
// Our admin user for this test doesn't have the "administer permissions"
// permission, so the permission reminder should not be included.
$assert_session
->pageTextNotContains('Please remember to set the permissions for the newly enabled searches.');
// Edit the search.
$this
->click('.dropbutton-action a[href$="/edit"]');
$this
->logPageChange();
$assert_session
->addressEquals($this
->getAdminPath('edit'));
$page = $this
->getSession()
->getPage();
$page
->findButton('Show row weights')
->click();
$edit = [
'suggesters[enabled][server]' => TRUE,
'suggesters[enabled][search_api_autocomplete_test]' => TRUE,
'suggesters[weights][search_api_autocomplete_test][limit]' => '3',
'suggesters[weights][server][limit]' => '3',
'suggesters[weights][search_api_autocomplete_test][weight]' => '0',
'suggesters[weights][server][weight]' => '10',
'options[limit]' => '5',
'options[min_length]' => '2',
'options[show_count]' => TRUE,
];
$this
->submitForm($edit, 'Save');
}