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.