Add tests for search admin

Created on 28 January 2014, over 11 years ago
Updated 11 March 2025, about 2 months ago

On #2179081: [meta] Inventory search.module tests. File issues to address test holes. β†’ several areas of Search module administration were identified that are lacking in tests.

In this issue, tests for the following should be added:

a) Page CRUD: Update SearchConfigSettingsFormTests to make sure it is really testing the following:

Verify that you can use the UI to add/configure/enable/disable/delete search pages based on plugin types, choose the order, and choose a default page. Verify that if you go to /search you get to the set default search page. Also that you can click through to the other tabs, that disabled pages are not shown, and that the pages are in the correct order. Also that the search block goes to the set default page.

There seem to be some holes in the tests. The inventory found the following:

  • SearchConfigSettingsFormTests::searchModuleSettingsPage tests that plugin-specific config can be edited in the UI, although it does not verify that this config can be used later for anything.
  • SearchConfigSettingsFormTests::testSearchModuleDisabling() tests that a default can be set by visiting the correct URL, and that it works from the search page and the search block, and that if this is the only enabled search type, the other tabs are not visible. Also verifies that with other tabs enabled, all are shown after directly going to the correct URL search/node. However, it doesn't disable via the UI but via $entity->disable() method in code.
  • SearchConfigSettingsFormTests::testDefaultSearchPageOrdering() tests that out of the box the order of search tabs at URL /search is correct.
  • SearchConfigSettingsFormTests::testMultipleSearchPages() tests that you can add new search pages with the UI, and that they are both displayed at /search, and that the order can be set via the UI (in that the order "sticks"). It also tests that the operations links are present and that after enable, disable, and delete, the search config screen has the right pages and operations visible, but it doesn't verify this is reflected at /search.
  • SearchBlockTest: verifies you go to search/node and that both positive and negative searches work; doesn't test what happens if the default has been changed.

b) Admin permissions: Verify that users without administer search permissions cannot do the search page config/CRUD operations or other search admin operations

c) Finding admin page: Verify that you can find the admin page link on admin/config and admin/config/search

d) Verify that settings for min word length and CJK handling can be set from the Search Settings page and that the settings work correctly during indexing and during searching. Existing tests related to this:

SearchConfigSettingsFormTest - tests that invalid values for word length (not an integer) cannot be saved, and that the default values allow the form to be submitted. Doesn't test that other values can be saved or that they do anything useful.

Tokenizing all known ranges of CJK characters is tested in SearchTokenizerTest, which also verifies that English letter characters are not tokenized this way. Calls search_simplify() explicitly with the config set to tokenize at one character.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

search.module

Created by

πŸ‡ΊπŸ‡ΈUnited States jhodgdon Spokane, WA, USA

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024