Skip to content

Fix tests for 8.4 #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/LexicalGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class LexicalGrammarTest extends TestCase {
private $expectedTokensFile;
private $tokens;
const FILE_PATTERN = __DIR__ . "/cases/lexical/*";
const PHP84_FILE_PATTERN = __DIR__ . "/cases/lexical84/*";
const PATTERNS_FOR_MINIMUM_PHP_VERSION = [
[80400, self::PHP84_FILE_PATTERN],
];
public function run(?TestResult $result = null) : TestResult {
if (!isset($GLOBALS["GIT_CHECKOUT_LEXER"])) {
$GLOBALS["GIT_CHECKOUT_LEXER"] = true;
Expand Down Expand Up @@ -64,9 +68,23 @@ public function lexicalProvider() {
if (in_array(basename($testCase), $skipped)) {
continue;
}

if (PHP_VERSION_ID >= 80400 && basename($testCase) === 'keyword5.php') {
continue;
}

$testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"];
}

foreach (self::PATTERNS_FOR_MINIMUM_PHP_VERSION as list($minVersionId, $filePattern)) {
if (PHP_VERSION_ID >= $minVersionId) {
$testCases = glob($filePattern . ".php");
foreach ($testCases as $testCase) {
$testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"];
}
}
}

return $testProviderArray;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/cases/lexical84/keyword5.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
yield /*awesome*/ from
14 changes: 14 additions & 0 deletions tests/cases/lexical84/keyword5.php.tokens
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"kind": "ScriptSectionStartTag",
"textLength": 6
},
{
"kind": "YieldFromKeyword",
"textLength": 22
},
{
"kind": "EndOfFileToken",
"textLength": 0
}
]