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

Files: 
CommentFileSizeAuthor
#4 rename_variable-2080057-4.patch743 bytesdrupal_sensei
PASSED: [[SimpleTest]]: [MySQL] 58,684 pass(es).
[ View ]
#2 drupal8.node-module.2080057-2.patch708 bytesguregori
PASSED: [[SimpleTest]]: [MySQL] 59,162 pass(es).
[ View ]

Comments

Assigned:Unassigned» guregori

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

Removed line 64.

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.

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

Like this?

Status:Needs review» Reviewed & tested by the community

Yes, I think this is ok.

Assigned:guregori» Unassigned

Title:Remove Unused local variable $node from /core/modules/node/lib/Drupal/node/Tests/NodeFormButtonsTest.phpFix 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.