diff --git a/core/modules/search/lib/Drupal/search/Form/SearchPageAddForm.php b/core/modules/search/lib/Drupal/search/Form/SearchPageAddForm.php index fb47b25..db7d175 100644 --- a/core/modules/search/lib/Drupal/search/Form/SearchPageAddForm.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchPageAddForm.php @@ -35,14 +35,14 @@ protected function actions(array $form, array &$form_state) { * {@inheritdoc} */ public function save(array $form, array &$form_state) { - parent::save($form, $form_state); - - drupal_set_message($this->t('The search page has been added.')); - // If there is no default search page, make the added search the default. if (!$this->searchPageRepository->getDefaultSearchPage()) { $this->searchPageRepository->setDefaultSearchPage($this->entity); } + + parent::save($form, $form_state); + + drupal_set_message($this->t('The search page has been added.')); } } diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php index ae35fc5..150b0b6 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php @@ -210,7 +210,7 @@ public function testMultipleSearchPages() { $search_storage = \Drupal::entityManager()->getStorageController('search_page'); $entities = $search_storage->loadMultiple(); $search_storage->delete($entities); - $this->assertDefaultSearch(NULL, 'There is no default page.'); + $this->assertDefaultSearch(FALSE); // Ensure that no search pages are configured. $this->drupalGet('admin/config/search/settings'); @@ -268,27 +268,27 @@ public function testMultipleSearchPages() { // Check the initial state of the search pages. $this->drupalGet('admin/config/search/settings'); - $this->assertSearchPageOperations($first_id, TRUE, FALSE, FALSE, FALSE); - $this->assertSearchPageOperations($second_id, TRUE, TRUE, TRUE, FALSE); + $this->verifySearchPageOperations($first_id, TRUE, FALSE, FALSE, FALSE); + $this->verifySearchPageOperations($second_id, TRUE, TRUE, TRUE, FALSE); // Change the default search page. $this->clickLink(t('Set as default')); $this->assertRaw(t('The default search page is now %label. Be sure to check the ordering of your search pages.', array('%label' => $second['label']))); - $this->assertSearchPageOperations($first_id, TRUE, TRUE, TRUE, FALSE); - $this->assertSearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); + $this->verifySearchPageOperations($first_id, TRUE, TRUE, TRUE, FALSE); + $this->verifySearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); // Disable the first search page. $this->clickLink(t('Disable')); $this->assertResponse(200); $this->assertNoLink(t('Disable')); - $this->assertSearchPageOperations($first_id, TRUE, TRUE, FALSE, TRUE); - $this->assertSearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); + $this->verifySearchPageOperations($first_id, TRUE, TRUE, FALSE, TRUE); + $this->verifySearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); // Enable the first search page. $this->clickLink(t('Enable')); $this->assertResponse(200); - $this->assertSearchPageOperations($first_id, TRUE, TRUE, TRUE, FALSE); - $this->assertSearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); + $this->verifySearchPageOperations($first_id, TRUE, TRUE, TRUE, FALSE); + $this->verifySearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE); } /** @@ -305,7 +305,7 @@ public function testMultipleSearchPages() { * @param bool $enable * Whether the enable link is expected. */ - protected function assertSearchPageOperations($id, $edit, $delete, $disable, $enable) { + protected function verifySearchPageOperations($id, $edit, $delete, $disable, $enable) { if ($edit) { $this->assertLinkByHref("admin/config/search/settings/manage/$id"); }