You are here

public function SearchConfigSettingsFormTest::testSearchModuleSettingsPage in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testSearchModuleSettingsPage()

Verifies plugin-supplied settings form.

File

core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php, line 131

Class

SearchConfigSettingsFormTest
Verify the search config settings form.

Namespace

Drupal\Tests\search\Functional

Code

public function testSearchModuleSettingsPage() {
  $this
    ->drupalGet('admin/config/search/pages');
  $this
    ->clickLink(t('Edit'), 1);

  // Ensure that the default setting was picked up from the default config
  $this
    ->assertSession()
    ->elementExists('xpath', '//select[@id="edit-extra-type-settings-boost"]//option[@value="bi" and @selected="selected"]');

  // Change extra type setting and also modify a common search setting.
  $edit = [
    'extra_type_settings[boost]' => 'ii',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save search page'));

  // Ensure that the modifications took effect.
  $this
    ->assertRaw(t('The %label search page has been updated.', [
    '%label' => 'Dummy search type',
  ]));
  $this
    ->drupalGet('admin/config/search/pages/manage/dummy_search_type');
  $this
    ->assertSession()
    ->elementExists('xpath', '//select[@id="edit-extra-type-settings-boost"]//option[@value="ii" and @selected="selected"]');
}