Problem/Motivation
Remove unused variable $translation from BulkFormTest. There are couple of instances
core/modules/node/tests/src/Functional/Views/BulkFormTest.php
// Create translations for all languages for some nodes.
for ($i = 0; $i < 2; $i++) {
$node = $this->nodes[$i];
foreach ($langcodes as $langcode) {
if (!$node->hasTranslation($langcode)) {
$title = $this->randomMachineName() . ' [' . $node->id() . ':' . $langcode . ']';
$translation = $node->addTranslation($langcode, ['title' => $title, 'promote' => FALSE]);
}
}
$node->save();
}
// Create a node with only one translation.
$node = $this->nodes[2];
$langcode = 'en';
$title = $this->randomMachineName() . ' [' . $node->id() . ':' . $langcode . ']';
$translation = $node->addTranslation($langcode, ['title' => $title]);
$node->save();
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3331900-2.patch | 1.27 KB | noorulshameera |
Comments
Comment #2
noorulshameera commentedAdding a patch which removes the unused variables.
Comment #3
anmolgoyal74 commentedComment #4
nidhi27This patch is working as expected and removing the unused variables.
Comment #5
alexpottWe do have automated code checks for unused variables but assignment in a loop is tricky to check for so they must not catch this one.
Committed and pushed 121e42f8b4 to 10.1.x and f24cbd8b99 to 10.0.x and 2760d9bac1 to 9.5.x. Thanks!
Backported to 9.5.x to keep tests aligned.