Problem/Motivation
In core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php file in function testGetTasksBuildWithCacheabilityMetadata() $local_tasks is initialized but never used.
Proposed resolution
Remove unused $local_tasks variable.
public function testGetTasksBuildWithCacheabilityMetadata() {
......
->willReturn(new ParameterBag());
$cacheability = new CacheableMetadata();
- $local_tasks = $this->manager->getTasksBuild('menu_local_task_test_tasks_view', $cacheability);
-
// Ensure that all cacheability metadata is merged together.
$this->assertEquals(['tag.example1', 'tag.example2'], $cacheability->getCacheTags());
$this->assertEquals(['context.example1', 'context.example2', 'route', 'user.permissions'], $cacheability->getCacheContexts());
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | interdiff-0-3.txt | 847 bytes | mayurjadhav |
| #3 | unsused_variable-3158278-3.patch | 816 bytes | mayurjadhav |
| unsused-variable-removed.patch | 862 bytes | hardik_patel_12 |
Comments
Comment #3
mayurjadhav commentedis necessary to run the test.
Added updated patch with interdiff, Kindly review.
Comment #4
mayurjadhav commentedComment #6
mayurjadhav commented#3 is a random failure, Moving back to NR, as retest is passed.
Comment #7
paulocsPatch #3 looks good to me.
The variable $local_tasks was added in issue #2511516: Make local tasks and actions hooks provide cacheability metadata, to make the blocks showing them cacheable.
There is no need have this variable. Set to RTBC.
Cheers, Paulo.
Comment #9
hardik_patel_12 commentedRandom failure , setting back to RTBC.
Comment #11
catchCommitted d0c9515 and pushed to 9.1.x. Thanks!