Skip to content

Commit 1f719e1

Browse files
Fix 8.4 tests
1 parent 457738c commit 1f719e1

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

tests/LexicalGrammarTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class LexicalGrammarTest extends TestCase {
1717
private $expectedTokensFile;
1818
private $tokens;
1919
const FILE_PATTERN = __DIR__ . "/cases/lexical/*";
20+
const PHP84_FILE_PATTERN = __DIR__ . "/cases/lexical84/*";
21+
const PATTERNS_FOR_MINIMUM_PHP_VERSION = [
22+
[80400, self::PHP84_FILE_PATTERN],
23+
];
2024
public function run(?TestResult $result = null) : TestResult {
2125
if (!isset($GLOBALS["GIT_CHECKOUT_LEXER"])) {
2226
$GLOBALS["GIT_CHECKOUT_LEXER"] = true;
@@ -64,9 +68,23 @@ public function lexicalProvider() {
6468
if (in_array(basename($testCase), $skipped)) {
6569
continue;
6670
}
71+
72+
if (PHP_VERSION_ID >= 80400 && basename($testCase) === 'keyword5.php') {
73+
continue;
74+
}
75+
6776
$testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"];
6877
}
6978

79+
foreach (self::PATTERNS_FOR_MINIMUM_PHP_VERSION as list($minVersionId, $filePattern)) {
80+
if (PHP_VERSION_ID >= $minVersionId) {
81+
$testCases = glob($filePattern . ".php");
82+
foreach ($testCases as $testCase) {
83+
$testProviderArray[basename($testCase)] = [$testCase, $testCase . ".tokens"];
84+
}
85+
}
86+
}
87+
7088
return $testProviderArray;
7189
}
7290

tests/cases/lexical84/keyword5.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+
yield /*awesome*/ from
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"kind": "ScriptSectionStartTag",
4+
"textLength": 6
5+
},
6+
{
7+
"kind": "YieldFromKeyword",
8+
"textLength": 22
9+
},
10+
{
11+
"kind": "EndOfFileToken",
12+
"textLength": 0
13+
}
14+
]

0 commit comments

Comments
 (0)