Part of meta-issue #2002650: [meta] improve maintainability by removing unused local variables

File /core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php

Line 64: Unused local variable $node

#4 rename_variable-2080057-4.patch743 byteswouters_f
PASSED: [[SimpleTest]]: [MySQL] 58,684 pass(es). View
#2 drupal8.node-module.2080057-2.patch708 bytesG2
PASSED: [[SimpleTest]]: [MySQL] 59,162 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


G2’s picture

Assigned: Unassigned » G2
G2’s picture

Status: Active » Needs review
708 bytes
PASSED: [[SimpleTest]]: [MySQL] 59,162 pass(es). View

Removed line 64.

SeyV’s picture

Status: Needs review » Needs work
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php
@@ -61,7 +61,6 @@ function testNodeFormButtons() {
-    $node = node_load(1, TRUE);

This is not the right solution. The problem is $node should be $node_1. By removing this var the next test will always be successful because the $node_1, loaded earlier in the code, will not be reloaded.

wouters_f’s picture

Status: Needs work » Needs review
743 bytes
PASSED: [[SimpleTest]]: [MySQL] 58,684 pass(es). View

Like this?

SeyV’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I think this is ok.

SeyV’s picture

Assigned: G2 » Unassigned
alexpott’s picture

Title: Remove Unused local variable $node from /core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.php » Fix assertion in NodeFormButtonsTest.php
Component: other » node.module
Category: task » bug
Status: Reviewed & tested by the community » Fixed

Retitling as this is now a fix - nice catch.

Committed 33b448c and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.