Problem/Motivation

(Rewritten after request on comment #10.)

We need to test top-level tab creation separately from tray creation, when using hook_toolbar() to do so.

The current tests use toolbar_test.module to only test returning both a top-level tab and a tray together, so not covering the full range of behaviours.

Proposed resolution

Because any given module's hook_toolbar() always returns the same array of data, we need multiple implementations to test multiple scenarios.

  1. Rename module toolbar_test to toolbar_test_tab_and_tray.
  2. (Maybe run this through coder-review when doing so, as e.g. indentation seems a little off?)
  3. Clone it to create two new modules toolbar_test_tab and toolbar_test_tray, and edit down their hook_toolbar() implementations.
  4. Similarly with ToolbarHookToolbarTest, rename and clone, to test now three different toolbar_test_* modules.

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Update the issue summary Instructions Yes
Create a patch Instructions
Add automated tests Instructions

User interface changes

None: tabs and trays are only added during running of tests.

API changes

None: new tests are only autodiscovered during running of tests.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benjifisher’s picture

@jessebeach:

In #1137920: Fix toolbar on small screen sizes and redesign toolbar for desktop you have been saying that "benjifisher is working on" this issue. Not yet. I will get to it soon. (Too many comments and too many followers on that issue, and I do not want to add to the overload.)

If anyone else wants to work on it, I promise to post a comment when I start. I hate duplicated effort.

I can exercise hook_toolbar() and hook_toolbar_alter(). I would appreciate help, advice, or pointers on how to test the javascript.

jessebeach’s picture

No need to address JavaScript testing, just simpletests of PHP. We'll be adding JS tests after code freeze.

Shyamala’s picture

Issue tags: +toolbar-followup

editing tags

YesCT’s picture

I was looking for a simpletest from when the toolbar went in, that tested for icons, so I could copy it for this language issue:
#1848552: Toolbar icons disappear with translated menu

It sounds like there are not tests yet?

benjifisher’s picture

I am working on rewriting hook_toolbar() in #1847198: Update the structure returned by hook_toolbar(). I will submit patches here when that work is done. For now, I have set up a sandbox project for a testing/example module for the toolbar hooks: http://drupal.org/sandbox/benji/1862108.

I would like to have help on the sandbox project from someone who knows CSS, icons, and javascript better than I do.

benjifisher’s picture

Status: Active » Postponed

The existing tests are being updated as part of #1847198: Update the structure returned by hook_toolbar(). I think it makes sense to wait until that issue is resolved before adding any more, so I am marking this issue Postponed.

According to the discussion in #1532612: Move Examples Project into Drupal core, we should do much more than the tests suggested in the issue summary. We should test every edge case we can imagine and do our best to break the API.

benjifisher’s picture

Issue summary: View changes

Updated issue summary.

mgifford’s picture

Issue summary: View changes
Status: Postponed » Active
Related issues: +#1847198: Update the structure returned by hook_toolbar()
Wim Leers’s picture

Title: Establish test coverage for toolbar module. » Expand test coverage for Toolbar module: test a top-level tab without a tray
Issue tags: +Novice, +php-novice

Add a top-level tab with a tray

We have this now, was added in #1847198: Update the structure returned by hook_toolbar().

We don't have

Add a top-level tab

yet.

Updating accordingly.

Wim Leers’s picture

Issue summary: View changes
YesCT’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

I think this needs an issue summary update in order for a new contributor to understand what needs to be done.

https://drupal.org/core-mentoring/novice-tasks helps people decide what is a novice task and what is not

jp.stacey’s picture

Issue tags: +SprintWeekend2016

Looking at this as part of Sprint Weekend 2016.

jp.stacey’s picture

Issue summary: View changes
Status: Active » Needs work
Issue tags: -Needs issue summary update +needs patch

Updated issue summary. I'm happy to work on this if the proposed solution looks right, but given I've expanded a lot on the original description it would be good to get some other eyes on it before I go off on a tangent!

olafkarsten’s picture

Version: 8.0.x-dev » 8.2.x-dev
Status: Needs work » Needs review
Issue tags: +DrupalBCDays
FileSize
1.52 KB

I don't think we need a bunch of separate modules here. We could simple expand the existing test. Or do I miss something?
Here is my try.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dimaro’s picture

Patch no longer applies against 8.4.x
Reroll #13 against 8.4.x

Does the proposed solution remain the same as the indicated in the issue description?

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -, -needs patch +Needs Review Queue Initiative, +Needs issue summary update

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.

The tasks in the IS

  • Rename module toolbar_test to toolbar_test_tab_and_tray.
  • (Maybe run this through coder-review when doing so, as e.g. indentation seems a little off?)
  • Clone it to create two new modules toolbar_test_tab and toolbar_test_tray, and edit down their hook_toolbar() implementations.
  • Similarly with ToolbarHookToolbarTest, rename and clone, to test now three different toolbar_test_* modules.

From what I can tell these haven't happened.

Nikhil_110’s picture

Attached patch against drupal 10.1.x

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.