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

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

Line 64: Unused local variable $node

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

G2’s picture

Assigned: Unassigned » G2
G2’s picture

Status: Active » Needs review
FileSize
708 bytes

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
FileSize
743 bytes

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.