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
AssertLegacyTrait::assertEscaped() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->assertEscaped() instead. See https://www.drupal.org/node/3129738
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#16 | rawdiff_14-16.txt | 3.31 KB | mondrake |
#16 | 3139433-16.patch | 55.98 KB | mondrake |
#14 | 3139433-14.patch | 56.26 KB | mohrerao |
Comments
Comment #2
jungleAdding the "Deprecated assertions" tag to add this into the kanban board https://contribkanban.com/board/Deprecatedassertions
Comment #3
mondrakeSome of the current calls to assert(No)Escaped in functional tests still have a message passed in, even if AssertLegacyTrait::assert(No)Escaped() do not take that in. We need to remove the messages from the calls and inline them as comments where appropriate before doing the conversion.
Comment #4
mondrake#3142752: AssertLegacyTrait::assert(No)Escaped() in functional tests still have a message passed in got committed, unpostponing.
Comment #5
mondrakeOn this.
Comment #6
mondrakeRemoved usages, removed depraction silencers, added a deprecation test.
Comment #8
mondrakeOn it
Comment #9
mondrakeComment #10
Hardik_Patel_12 CreditAttribution: Hardik_Patel_12 at QED42 commentedPatch failed to apply , kindly review a new patch.
Comment #11
jungleThanks @Hardik_Patel_12!
It‘s worthy to do micro-optimizations for changes which similar to the above. See the code blew from
\Drupal\FunctionalTests\AssertLegacyTrait::assertSession()
.we should avoid calling $this->assertSession() multiple times in a test. Each call returns a new instance, it's not good. Instead, saving it as a local variable, for example,
$assert_session = $this->assertSession();
and using$assert_session
for next one(s).Comment #12
nitesh624Comment #13
jungleSetting back to NR, it's not worthy to do such micro-optimizations or undecided. See discussions in the parent issue for more.
Comment #14
mohrerao CreditAttribution: mohrerao as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedRerolled as patch failed to apply
Comment #15
nitesh624Unassigning as I see others progressing on this.
Comment #16
mondrakeRerolled, no more calls present in test code
Comment #17
dwwAs with #3139408-14: Replace usages of AssertLegacyTrait::assert(No)Field, that is deprecated, what's up with:
core/tests/Drupal/KernelTests/AssertContentTrait.php defining non-deprecated versions of
assert(No)?Escaped()
?That seems highly problematic. Not sure where that's being addressed, but I don't think this is RTBC without reckoning with that.
Sorry,
-Derek
Comment #18
mondrake#17 see #3027952-50: [Plan] Remove the usage of deprecated methods in tests.
Comment #19
dwwThanks for clarifying! +1 to RTBC then. I read through the patch and it's just the fix to remove the deprecation from the skip list, the new @legacy deprecation test, and the results of a script. ;)
Thanks,
-Derek
Comment #20
catchCommitted 7628e38 and pushed to 9.1.x. Thanks!