Problem/Motivation
\Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern uses regex to find matching book items.
Steps to reproduce
Proposed resolution
Replace with methods from \Drupal\Tests\WebAssert so it isn't so brittle
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | interdiff_3325730_7-11.txt | 2.38 KB | ankithashetty |
| #11 | 3325730-11.patch | 4.47 KB | ankithashetty |
| #7 | 3325730-7.patch | 4.32 KB | larowlan |
| #7 | 3325730-7-interdiff.txt | 955 bytes | larowlan |
| #4 | 3325730-4.patch | 4.29 KB | alok_singh |
Comments
Comment #2
larowlanComment #3
larowlanComment #4
alok_singh commentedFIxed CCF of #2.
Please review.
Comment #6
pwolanin commentedThere is only one use of
generateOutlinePattern()?Since this is test-only code, I don't understand why it's deprecated instead of just removed.
Comment #7
larowlanPer BC policy
So as this is a trait, we need a BC dance.
Fixing the fail
Comment #8
smustgrave commentedThis 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.
Reviewing the code and webassert changes look good and correct deprecation call looks correct.
LGTM.
Comment #9
xjmThanks for working on this! There are just some minor issues with the local variable naming.
Yech, glad we are getting rid of that.
I think it should probably be
$book_navigation. Even though it's passing cspell, we generally don't use abbreviations in variable names.$previousElis again using an abbreviation, and furthermore breaking the "don't mix camel and snake case" rule. It should be$previous_element.In the same vein, this should be
$parent_element.And
$next_element.Comment #10
larowlanTagging the above for a Novice, this was something I hit with failing tests from Tome module because this trait was flaky af, I think most of the variable names were pre-existing, but agree, let's fix them
Comment #11
ankithashettyUpdated patch in #7 with the nitpicks pointed out in #9. Also fixed phpcs warnings w.r.t to the patch changes only.
Thanks!
Comment #12
spokjeShouldn't we test the added Deprecation somewhere?
Comment #13
smustgrave commentedConfirmed #11 addresses the points in #9
@Spokje I see the deprecation at the bottom for the generateOutlinePattern function.
Comment #14
spokjeThanks @smustgrave, apparently I didn't scroll all the way down... _facepalm_
Comment #16
spokjeLooks like a random JS test failure, requeued test to make sure.
Comment #18
xjmI compared this with the existing method, which is:
The only test coverage we're removing is that of testing the markup. And we shouldn't test the markup, because the markup is the theme's business.
I also verified that the fail in https://www.drupal.org/pift-ci-job/2573719 was in an unrelated test (we should always watch for exactly what JS random fails are when we are updating a JS test).
Spokje's earlier feedback is unaddressed:
@smustgrave replied:
@Spokje was asking about test coverage for the new deprecation, not the deprecation itself. Bit of miscommunication there. However, we don't necessarily need to add test coverage for deprecations in internal APIs. The policy states:
I especially think we don't need test coverage for the deprecation of a very funky and situationally specific method that is used only once in core for what is already a low-usage module, so here is release management signoff for not having test coverage of that. 🪄
Committed to 10.1.x only since it contains a deprecation. Thanks! Although, I hope we'll be deprecating the whole module for D11... Also published the change record.
Comment #20
alok_singh commentedComment #21
alok_singh commented