function SearchConfigSettingsFormTest::testSearchModuleSettingsPage

Same name in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testSearchModuleSettingsPage()
  2. 10 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testSearchModuleSettingsPage()
  3. 11.x 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"]');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.