Skip to content

Commit 397b6c9

Browse files
committed
Tests: add fixture for single unused global
1 parent e57a4f0 commit 397b6c9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

VariableAnalysis/Tests/CodeAnalysis/VariableAnalysisTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public function testFunctionWithGlobalVarWarnings() {
9595
8,
9696
23,
9797
28,
98-
29
98+
29,
99+
39,
99100
];
100101
$this->assertEquals($expectedWarnings, $lines);
101102
}
@@ -734,6 +735,7 @@ public function testValidUndefinedVariableNamesIgnoresVarsInGlobalScope() {
734735
4,
735736
7,
736737
23,
738+
39,
737739
];
738740
$this->assertEquals($expectedWarnings, $lines);
739741
}

VariableAnalysis/Tests/CodeAnalysis/fixtures/FunctionWithGlobalVarFixture.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ function updateGlobal($newVal) {
3434
global $myGlobal;
3535
$myGlobal = $newVal;
3636
}
37+
38+
function unusedGlobal() {
39+
global $myGlobal; // should warn that var is unused
40+
}

0 commit comments

Comments
 (0)