Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Feb 7, 2025
1 parent 25a8ef0 commit def7293
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
19 changes: 10 additions & 9 deletions tests/ReportOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ public function testConsoleReportNoSnippet(): void
ERROR: MixedReturnStatement - somefile.php:3:10 - Could not infer a return type (see https://psalm.dev/138)
ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined (see https://psalm.dev/020)
ERROR: UndefinedConstant - somefile.php:8:6 - Const CHANGE_ME is not defined, consider enabling the allConstantsGlobal config option if scanning legacy codebases (see https://psalm.dev/020)
INFO: PossiblyUndefinedGlobalVariable - somefile.php:17:6 - Possibly undefined global variable $a, first seen on line 11 (see https://psalm.dev/126)
Expand Down Expand Up @@ -1087,14 +1087,15 @@ public function testCompactReport(): void
<<<'EOF'
FILE: somefile.php
+----------+------+---------------------------------+--------------------------------------------------------------+
| SEVERITY | LINE | ISSUE | DESCRIPTION |
+----------+------+---------------------------------+--------------------------------------------------------------+
| ERROR | 3 | UndefinedVariable | Cannot find referenced variable $as_you_____type |
| ERROR | 3 | MixedReturnStatement | Could not infer a return type |
| ERROR | 8 | UndefinedConstant | Const CHANGE_ME is not defined, consider enabling the allConstantsGlobal config option if scanning legacy codebases |
| INFO | 17 | PossiblyUndefinedGlobalVariable | Possibly undefined global variable $a, first seen on line 11 |
+----------+------+---------------------------------+--------------------------------------------------------------+
+----------+------+---------------------------------+------------------------------------------------------------------------+
| SEVERITY | LINE | ISSUE | DESCRIPTION |
+----------+------+---------------------------------+------------------------------------------------------------------------+
| ERROR | 3 | UndefinedVariable | Cannot find referenced variable $as_you_____type |
| ERROR | 3 | MixedReturnStatement | Could not infer a return type |
| ERROR | 8 | UndefinedConstant | Const CHANGE_ME is not defined, consider enabling the allConstantsGlob |
| | | | al config option if scanning legacy codebases |
| INFO | 17 | PossiblyUndefinedGlobalVariable | Possibly undefined global variable $a, first seen on line 11 |
+----------+------+---------------------------------+------------------------------------------------------------------------+

EOF,
$this->toUnixLineEndings(IssueBuffer::getOutput(IssueBuffer::getIssuesData(), $compact_report_options)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

if (!defined('CODE_DIR')) {
$codeDir = 1;
/** @return int */
function getInteger(): int { return 1; }

if (!defined('CODE_DIR') && !defined('PSALM_VERSION')) {
$codeDir = getInteger();
define('CODE_DIR', $codeDir);
}

0 comments on commit def7293

Please sign in to comment.