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 links or routes of the module are being tested, see all routes:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
Currently, the module doesn't test any of links, routes defined by the admin_toolbar_tools module and the corresponding ToolbarController methods, see:
https://git.drupalcode.org/project/admin_toolbar/-/blob/3.x/admin_toolba...
Steps to reproduce
Run PHPUNIT Tests for the admin_toolbar_tools module.
Proposed resolution
Create a new Functional Tests class AdminToolbarToolsToolbarControllerTest which adds very basic Tests coverage:
For each route/link added by the module, try clicking on it and check whether the correct status message is displayed.
Any help, comments, suggestions or feedback would be greatly appreciated.
Thanks!
Issue fork admin_toolbar-3514774
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 #4
dydave commentedQuick follow-up on this issue:
Added very basic Functional Tests coverage for the
ToolbarControllerclass with the new classAdminToolbarToolsToolbarControllerTest:At least with these Tests, all the methods and code in the
ToolbarControllerclass will be executed, which should allow us to detect deprecation messages, various errors, crashes, breaking changes in merge requests, etc...The tests don't actually check whether each action effectively "worked", in the sense:
Each task is not tested specifically, for example, there is are no specific checks on caches, registries, etc...
But instead, the Tests execute each method's code from the
ToolbarControllerclass and check it completed without error (display the expected success message).Automated tests all seemed to be passing 🟢, therefore, I went ahead and merged the changes above at #3.
With these tests in place, there should be at least some very basic Functional validation for all the pending merge requests making changes to the
ToolbarControllerclass, see in particular related tickets.Important note: Fixed a minor error in the file
admin_toolbar.libraries.yml, recently introduced in commit:https://git.drupalcode.org/project/admin_toolbar/-/commit/d7c8da0ed63729...
Moved the added CSS library at the bottom of the file, without breaking the
toolbar.treelibrary.Marking issue Fixed for now.
Feel free to let us know if you have any questions or concerns on any of the changes merged in this ticket or the project in general, we would certainly be glad to help.
Thanks in advance!