Skip to content

Commit ef61898

Browse files
committed
Fix test
1 parent 601665c commit ef61898

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/Rules/Doctrine/ORM/DqlRuleTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
namespace PHPStan\Rules\Doctrine\ORM;
44

5+
use Composer\InstalledVersions;
56
use PHPStan\Rules\Rule;
67
use PHPStan\Testing\RuleTestCase;
78
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
9+
use function sprintf;
10+
use function strpos;
811

912
/**
1013
* @extends RuleTestCase<DqlRule>
@@ -19,9 +22,15 @@ protected function getRule(): Rule
1922

2023
public function testRule(): void
2124
{
25+
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
26+
if (strpos($ormVersion, '3.') === 0) {
27+
$lexer = 'TokenType';
28+
} else {
29+
$lexer = 'Lexer';
30+
}
2231
$this->analyse([__DIR__ . '/data/dql.php'], [
2332
[
24-
'DQL: [Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got end of string.',
33+
sprintf('DQL: [Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\%s::T_IDENTIFIER, got end of string.', $lexer),
2534
35,
2635
],
2736
[

0 commit comments

Comments
 (0)