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
In core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php providerTestSetLinkActiveClass()
initializes $markup
, but it never uses it.
Proposed resolution
Remove $markup
.
'query' => [],
];
// Nothing to do.
- $markup = '<foo>bar</foo>';
$situations[] = ['context' => $context, 'is active' => FALSE, 'attributes' => []];
// Matching path, plus all matching variations.
$attributes = [
Comment | File | Size | Author |
---|---|---|---|
unsused-variable-removed.patch | 692 bytes | Hardik_Patel_12 | |
Comments
Comment #2
apaderno$markup
is never used, but I am not sure'<foo>bar</foo>'
wasn't supposed to be used as test markup.Comment #3
adhershmnair CreditAttribution: adhershmnair commented$markup
is an unused variable. I have reviewed and applied the patch #1 and it is working fine.Comment #4
adhershmnair CreditAttribution: adhershmnair commentedComment #5
catchWe still need to address #2 - this can be done by checking git log -S and/or git blame, and checking where the variable was added and whether any references to it were removed by mistake.
Comment #6
adhershmnair CreditAttribution: adhershmnair at Zyxware Technologies commentedSeems the variable is used from initial commit of Issue #1979468
As per the issue Remove Unused local variables from system module
Here all other
$markup = '<foo>bar</foo>';
has been removed from the file in this commit.After these the filename changed to
core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php
fromcore/modules/system/tests/src/Unit/Controller/SystemControllerTest.php
in the commit of issue Set the 'is-active' class for anonymous users in a Response Filter instead of a #post_render_cache callbackAlso all instance of the
$markup
variable removed from the file.As per the new implementation we don't want this local variable.
So it seems the
$markup
is an unused variable and can be removed. And the patch is verified and working for me.RTBC!
Comment #8
catchThanks for checking the history. Also read through in context and the $create_markup inline function appears to have replaced whatever this cruft was going to do.
Committed 856ab5f and pushed to 9.1.x. Thanks!