Problem/Motivation
Currently tests coverage is very limited for the admin_toolbar_tools module, see:
https://git.drupalcode.org/project/admin_toolbar/-/tree/3.x/admin_toolba...
None of the settings of the module are being tested.
Currently, the module doesn't test any of the configuration variables defined by the admin_toolbar_tools module, except, saving its settings form with its default values, see:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
See module's settings default values:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
Steps to reproduce
Run PHPUNIT Tests for the admin_toolbar_tools module.
Run PHPUNIT Functional Test AdminToolbarToolsSettingsFormTest.
Proposed resolution
Improve the tests in existing class 'AdminToolbarToolsSettingsFormTest':
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
- Test the default state: displaying all (20) bundles, hoverintent library and local tabs.
- Set all the values of the form to enable all settings and display 3 items.
- Submit the form and check there is no error.
- Test all the values changed with the new settings.
Add tests and checks for different values for the different configuration variables.
max_bundle_number
Test the display of the links for different values of max_bundle_number:
Test 0, lower than, greater than the test_bundles_number.
For the assert/check we could use an xpath expression to check for the count of expected entity links under tested entity menu item.
Maybe something like this could be useful:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
With random names generated instead, preferably.
show_local_tasks
Check whether the local tasks menu is found in the toolbar in the response, see example above.
Any help, comments, suggestions or feedback would be greatly appreciated.
Thanks!
Issue fork admin_toolbar-3508772
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dydave commentedComment #3
dydave commentedRemoved the
hoverintent_functionalityfrom the issue summary, since it was moved toadmin_toolbarin issue #3516995: Move the 'hoverintent_functionality' setting to admin_toolbar.Comment #5
dydave commentedLong overdue follow-up on this issue 😅
But since I've been working on fixing module's tests, I thought we might as well get this one done 👍
All the changes detailed in the issue summary have been implemented and described in the merge request MR !174 above at #4.
Added the necessary logic to change form settings values so the expected results could be tested. 👌
\Drupal\admin_toolbar_tools\AdminToolbarToolsHelper::buildLocalTasksToolbar()
Since all the tests and jobs still seem to be passing 🟢, moving issue to Needs review as an attempt to get more testing feedback and reviews.
Overall, this merge request should complete the tests coverage for the admin_toolbar_tools module, along with related #3550604: Automated Tests: Add Functional tests for classes ExtraLinks and SearchLinks. 🥳
Feel free to let us know if you have any comments, questions or concerns on any aspects of this issue or the suggested changes in the merge request, we would surely be glad to help.
Thanks in advance!
Comment #6
dydave commentedComment #8
dydave commentedThis merge request only impacts a single PHPUNIT Functional Test class for the Admin Toolbar Tools module: 👌
admin_toolbar_tools/tests/src/Functional/AdminToolbarToolsSettingsFormTest.phpSo it should be really safe to merge this directly now, since all the Tests seem to be passing 🟢
Since these changes are going to greatly improve the Tests coverage of Admin Toolbar Tools Settings form and its configuration options, I went ahead and merged them above at #7. 🥳
Marking issue as Fixed, for now.
Testing feedback, comments or reviews would be greatly appreciated!
Thanks in advance!😊