Skip to content

Commit 2e5658b

Browse files
author
Kirill Nesmeyanov
committed
Upgrade functional tests
1 parent fb8c553 commit 2e5658b

File tree

1,206 files changed

+514248
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,206 files changed

+514248
-500
lines changed

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@
2020
}
2121
},
2222
"require-dev": {
23-
"justinrainbow/json-schema": "^5.2",
24-
"friendsofphp/php-cs-fixer": "^3.42",
23+
"friendsofphp/php-cs-fixer": "^3.52",
2524
"jetbrains/phpstorm-attributes": "^1.0",
26-
"nikic/php-parser": "^4.17",
27-
"phpdocumentor/reflection-docblock": "^5.3",
25+
"nikic/php-parser": "^4.17|^5.0",
2826
"phplrt/compiler": "^3.6",
29-
"phpunit/phpunit": "^10.5",
27+
"phpunit/phpunit": "^10.5|^11.0",
3028
"rector/rector": "^1.0",
31-
"symfony/var-dumper": "^5.6|^6.0|^7.0",
29+
"symfony/finder": "^5.4|^6.0|^7.0",
30+
"symfony/var-dumper": "^5.4|^6.0|^7.0",
31+
"type-lang/printer": "^1.0",
32+
"type-lang/phpdoc": "^1.0",
33+
"type-lang/phpdoc-standard-tags": "^1.0",
3234
"vimeo/psalm": "^5.18"
3335
},
3436
"autoload-dev": {

tests/Concern/CompileGrammarIfPossible.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
trait CompileGrammarIfPossible
1515
{
1616
#[BeforeClass]
17-
public static function setUpCompilerBeforeClass(): void
17+
public static function setUpCompileGrammarIfPossible(): void
1818
{
1919
// Skip code assembly if the compiler is not available.
2020
if (!\class_exists(Compiler::class)) {

tests/Concern/DocBlockReader.php

Lines changed: 0 additions & 157 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\Parser\Tests\Concern;
6+
7+
use PhpParser\Node;
8+
use PhpParser\Node\Stmt;
9+
use PhpParser\NodeTraverser;
10+
use PhpParser\NodeVisitorAbstract;
11+
use PHPUnit\Framework\AssertionFailedError;
12+
use PHPUnit\Framework\ExpectationFailedException;
13+
14+
trait InteractWithCommentsParser
15+
{
16+
use InteractWithPhpParser;
17+
18+
/**
19+
* @param array<array-key, Stmt> $statements
20+
* @return iterable<array-key, non-empty-string>
21+
* @throws \LogicException
22+
*/
23+
protected static function getCommentsFromStatements(array $statements): iterable
24+
{
25+
$comments = new \ArrayObject();
26+
$traverser = new NodeTraverser();
27+
28+
$traverser->addVisitor(new class ($comments) extends NodeVisitorAbstract {
29+
public function __construct(
30+
private readonly \ArrayObject $comments,
31+
) {}
32+
33+
public function enterNode(Node $node): void
34+
{
35+
$comment = $node->getDocComment();
36+
37+
if ($comment === null) {
38+
return;
39+
}
40+
41+
$this->comments['line ' . $node->getLine()] = $comment->getText();
42+
}
43+
});
44+
45+
$traverser->traverse($statements);
46+
47+
return $comments->getIterator();
48+
}
49+
50+
/**
51+
* @return iterable<array-key, non-empty-string>
52+
* @throws \LogicException
53+
* @throws ExpectationFailedException
54+
*/
55+
protected static function getCommentsFromPhpCode(string $code): iterable
56+
{
57+
return self::getCommentsFromStatements(
58+
statements: self::getStatementsFromPhpCode($code),
59+
);
60+
}
61+
62+
/**
63+
* @param non-empty-string $pathname
64+
* @return iterable<array-key, non-empty-string>
65+
* @throws ExpectationFailedException
66+
* @throws \LogicException
67+
* @throws AssertionFailedError
68+
*/
69+
protected static function getCommentsFromPhpFile(string $pathname): iterable
70+
{
71+
return self::getCommentsFromStatements(
72+
statements: self::getStatementsFromPhpFile($pathname),
73+
);
74+
}
75+
}

tests/Concern/InteractWithDocBlocks.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)