Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Currently, SelectTableSortDefaultTest is the only test in core that explicitly covers tablesort and also does a ->drupalGet() in the test to cover rendered output.
tablesort_header() will add titles to the links in the header row, but SelectTableSortDefaultTest does not check for these.
Proposed resolution
Add a new test to check the rendered output for the link title.
Remaining tasks
Write / update the test.- Review the test.
User interface changes
None.
API changes
None.
Beta phase evaluation
Unfrozen changes | Unfrozen because it only changes test code. |
---|---|
Prioritized changes | The main goal of this issue is increased test coverage. |
Disruption | None |
Comment | File | Size | Author |
---|---|---|---|
#18 | interdiff-13-18.txt | 773 bytes | martin107 |
#18 | add_test_coverage_for-2357997-18.patch | 1.18 KB | martin107 |
#13 | interdiff-11-13.txt | 799 bytes | martin107 |
#13 | add_test_coverage_for-2357997-13.patch | 1.18 KB | martin107 |
#11 | interdiff-04-11.txt | 1.38 KB | mpdonadio |
Comments
Comment #1
mpdonadioComment #2
mpdonadioFirst pass at a test.
Comment #3
cilefen CreditAttribution: cilefen commentedThese comments are unnecessary as a block. Either remove them or put each respective one above the actual check.
Comment #4
mpdonadioRemoved unnecessary comments.
Comment #6
star-szrI think adding test coverage should be a task per https://www.drupal.org/core/issue-category.
Comment #7
johndtaylor CreditAttribution: johndtaylor commentedRestest passed. Analysis of test code made sense.
Comment #8
mpdonadioI'm not sure if I did the beta phase eval properly. This just adds a test where we didn't have test coverage before. So it reduces fragility w/o any disruption.
Comment #9
alexpottLet's merge this into testTableSortDefaultSort since having two test methods do assertions against the same page seems wasteful.
I've completed the beta evaluation properly.
Comment #10
alexpottComment #11
mpdonadioMerged code into the other test method.
Comment #12
cilefen CreditAttribution: cilefen commentedThe first line must be one sentence, alone.
Comment #13
martin107 CreditAttribution: martin107 commentedTweaked the comments.
Comment #14
cdanik CreditAttribution: cdanik as a volunteer commentedHere at drupalcon LA sprints. I'll take a look at this.
Comment #15
cdanik CreditAttribution: cdanik as a volunteer commentedMatches drupal code standards. https://www.drupal.org/coding-standards
I applied the patch, seems OK. I ran the database tests locally, and they passed.
Comment #16
connorwk CreditAttribution: connorwk as a volunteer and commentedHere at the LA sprints. Going to remove some extra white-space from the previous patch and see if I can break the code, this is to see if the test actually works.
Comment #17
lauriiiThanks for working on this issue. With this patch we can make the test coverage of Drupal 8 again better! I did still find one nitpick from the patch:
Indentation is wrong
Comment #18
martin107 CreditAttribution: martin107 as a volunteer commentedthank you fixed.
Comment #19
connorwk CreditAttribution: connorwk as a volunteer and commentedI see martin107 already submitted the patch for the indentation but I broke code in-order to be sure the test fails in a local dev and it did fail.
So the test seems to be working as intended.
Comment #20
lauriiiThis looks good to me.
Comment #25
lauriiiComment #26
xjmThanks everyone for your work here.
Whenever a patch fails tests like that, please always document what the fail was before clicking retest. Seeing two fails and retests in a row like that raises a red flag that the patch might be introducing a random test failure. Especially in a patch like this that is specifically expanding test coverage.
There are no typical gotchas like random value generation, but I'm currently running the specific test from the patch locally 100 times to ensure that there's not some random failure with the assertion.
An xpath assertion might be better here? There are a handful of uses of
assertPattern()
in core for markup, though, so I can't think of a reason to actually block the patch on that. I wondered if this could introduce a random fail in circumstances when something with the markup output changed, but also couldn't think of a way that could happen.Leaving at RTBC while my laptop warms the house. :P
Comment #27
xjmAlrighty, no fails, so I'm at least confident this isn't introducing some high-frequency random fail. :)
This issue only changes test code, so per https://www.drupal.org/core/beta-changes, this can be completed any time during the Drupal 8 beta phase. Committed and pushed to 8.0.x. Thanks!