Skip to content
Snippets Groups Projects
Commit a625450a authored by Mark Fullmer's avatar Mark Fullmer Committed by Mark Fullmer
Browse files

Issue #3257891 by mark_fullmer: Drupal 10 compatibility

parent 89426f49
Branches
Tags 8.x-3.5
No related merge requests found
......@@ -2,6 +2,6 @@ name: Google CSE
type: module
description: Use Google Custom Search to search your site and/or any other sites.
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- drupal:search
......@@ -16,7 +16,7 @@ class GoogleCSEConfigTest extends BrowserTestBase {
*
* @var array
*/
public static $modules = [
protected static $modules = [
'google_cse',
'search',
];
......@@ -56,7 +56,7 @@ class GoogleCSEConfigTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
$this->strictConfigSchema = NULL;
parent::setUp();
$this->initializeTestUser();
......@@ -101,7 +101,7 @@ class GoogleCSEConfigTest extends BrowserTestBase {
'edit-results-display-here' => 'here',
'edit-custom-results-display-overlay' => 'overlay',
];
$this->drupalPostForm(NULL, $edit, 'edit-submit');
$this->submitForm($edit, 'Save');
$session->statusCodeEquals(200);
$this->drupalLogout();
......
......@@ -17,7 +17,7 @@ class GoogleCSEDisplayTest extends BrowserTestBase {
*
* @var array
*/
public static $modules = [
protected static $modules = [
'block',
'google_cse',
'search',
......@@ -52,7 +52,7 @@ class GoogleCSEDisplayTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
$this->strictConfigSchema = NULL;
parent::setUp();
$this->initializeTestUser();
......@@ -76,11 +76,7 @@ class GoogleCSEDisplayTest extends BrowserTestBase {
// Put the search block on pages.
$this->drupalGet('admin/structure/block');
$this->getSession()->getPage()->findLink('Place block')->click();
$this->assertLinkByHref(
'/admin/structure/block/add/search_form_block/stable',
0,
'Did not find the search block in block candidate list.'
);
$this->assertSession()->linkByHrefExists('/admin/structure/block/add/search_form_block/stable', 0, 'Did not find the search block in block candidate list.');
$block = $this->drupalPlaceBlock('search_form_block');
// Navigate to the settings form.
......@@ -94,7 +90,7 @@ class GoogleCSEDisplayTest extends BrowserTestBase {
'edit-results-display-here' => 'here',
'edit-custom-results-display-overlay' => 'overlay',
];
$this->drupalPostForm(NULL, $edit, 'edit-submit');
$this->submitForm($edit, 'Save');
// Set this as the default search.
$search_page_repository = \Drupal::service('search.search_page_repository');
......@@ -105,11 +101,10 @@ class GoogleCSEDisplayTest extends BrowserTestBase {
// Test the default search via the block form, from the front page.
$this->drupalGet('');
$terms = ['keys' => 'test'];
$this->drupalPostForm('', $terms, t('Search'));
$this->drupalGet('');
$this->submitForm($terms, 'Search');
$this->assertEqual(
$this->getUrl(),
Url::fromRoute('search.view_' . $entity_id, [], ['query' => ['keys' => $terms['keys']], 'absolute' => TRUE])->toString(), 'Submitted to correct URL.');
$this->assertEquals($this->getUrl(), Url::fromRoute('search.view_' . $entity_id, [], ['query' => ['keys' => $terms['keys']], 'absolute' => TRUE])->toString(), 'Submitted to correct URL.');
$session->elementExists('css', "div#google-cse-results");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment