Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2020 at 12:54 UTC
Updated:
11 Sep 2020 at 14:24 UTC
Jump to comment: Most recent
In core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php providerTestSetLinkActiveClass() initializes $markup, but it never uses it.
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
avpaderno$markupis never used, but I am not sure'<foo>bar</foo>'wasn't supposed to be used as test markup.Comment #3
adhershmnair commented$markupis an unused variable. I have reviewed and applied the patch #1 and it is working fine.Comment #4
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 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.phpfromcore/modules/system/tests/src/Unit/Controller/SystemControllerTest.phpin 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
$markupvariable removed from the file.As per the new implementation we don't want this local variable.
So it seems the
$markupis 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!