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!

Command icon 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

dydave created an issue. See original summary.

dydave’s picture

dydave’s picture

Issue summary: View changes

Removed the hoverintent_functionality from the issue summary, since it was moved to admin_toolbar in issue #3516995: Move the 'hoverintent_functionality' setting to admin_toolbar.

dydave’s picture

Title: PHPUnit: Improve tests for admin_toolbar_tools » Automated tests: Improve tests for AdminToolbarToolsSettingsFormTest
Status: Active » Needs review

Long 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. 👌

 
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!

dydave’s picture

Component: Code » Automated tests

  • dydave committed 813dc890 on 3.x
    Issue #3508772 by dydave: Automated tests: Improved tests for '...
dydave’s picture

Status: Needs review » Fixed

This merge request only impacts a single PHPUNIT Functional Test class for the Admin Toolbar Tools module: 👌
admin_toolbar_tools/tests/src/Functional/AdminToolbarToolsSettingsFormTest.php

So 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!😊

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.