Automated tests: Merge several Functional test classes

Created on 6 August 2025, 5 days ago

Problem/Motivation

In more recent iterations and code changes (see related issues), new Functional test classes were added to test the three modules admin settings forms:

  • \Drupal\Tests\admin_toolbar_search\Functional\AdminToolbarSearchSettingsFormTest
  • \Drupal\Tests\admin_toolbar_tools\Functional\AdminToolbarToolsSettingsFormTest
  • \Drupal\Tests\admin_toolbar\Functional\AdminToolbarSettingsFormTest

It now appears certain Functional test classes that existed previously could potentially be merged or included in recently added test classes listed above.

This would reduce the number of Functional tests files in the project, in particular for smaller test classes, where few assertions are processed, see:

  • \Drupal\Tests\admin_toolbar_search\Functional\AdminToolbarSearchSettingTest
  • \Drupal\Tests\admin_toolbar_tools\Functional\AdminToolbarToolsAlterTest
  • \Drupal\Tests\admin_toolbar\Functional\AdminToolbarAlterTest

The setup of the tests could be grouped and the assertions from these tests could be moved to the corresponding module's settings form Functional test class.

I would "guess" these classes were added at very early stages of the project (back in 2015) as a basis for implementing Functional tests, with the intention of expanding and building on them as the module would evolve.

But at this point, we have already developed our own set of tests classes and therefore these older ones should not be needed anymore.

Steps to reproduce

Run PHPUNIT Functional tests.

Proposed resolution

1 - Merge class \Drupal\Tests\admin_toolbar_search\Functional\AdminToolbarSearchSettingTest into \Drupal\Tests\admin_toolbar_search\Functional\AdminToolbarSearchSettingsFormTest:
The values of the Admin Toolbar Search configuration (admin_toolbar_search.settings) are already updated/changed in class AdminToolbarSearchSettingsFormTest, so we would just need to check for the display of the relevant HTML IDs of the module.
Additionally, we could improve the Functional test class by testing the permission 'use admin toolbar search', instead of testing this in FunctionalJavascript \Drupal\Tests\admin_toolbar_search\FunctionalJavascript\AdminToolbarSearchTest
==> To be removed in a different ticket.
Also add checks for the route '/admin/admin-toolbar-search' to test access control with the permission.

2 - Merge class \Drupal\Tests\admin_toolbar_tools\Functional\AdminToolbarToolsAlterTest into \Drupal\Tests\admin_toolbar_tools\Functional\AdminToolbarToolsSettingsFormTest:
Move a single assertion.

3 - Merge class \Drupal\Tests\admin_toolbar\Functional\AdminToolbarAlterTest into \Drupal\Tests\admin_toolbar\Functional\AdminToolbarSettingsFormTest:
Move a single assertion.
 

📌 Task
Status

Active

Version

3.0

Component

Automated tests

Created by

🇫🇷France dydave

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dydave
  • Pipeline finished with Success
    5 days ago
    Total: 261s
    #566476
  • Pipeline finished with Success
    5 days ago
    Total: 224s
    #566501
  • 🇫🇷France dydave

    Quick follow-up on this issue:

    All the changes detailed in the issue summary have been implemented and described in the merge request MR !168 above at #2.

    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.

    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!

Production build 0.71.5 2024