Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 9, 2024
1 parent 601665c commit ef61898
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Rules/Doctrine/ORM/DqlRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

namespace PHPStan\Rules\Doctrine\ORM;

use Composer\InstalledVersions;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
use function sprintf;
use function strpos;

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

public function testRule(): void
{
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
if (strpos($ormVersion, '3.') === 0) {
$lexer = 'TokenType';
} else {
$lexer = 'Lexer';
}
$this->analyse([__DIR__ . '/data/dql.php'], [
[
'DQL: [Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got end of string.',
sprintf('DQL: [Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\%s::T_IDENTIFIER, got end of string.', $lexer),
35,
],
[
Expand Down

0 comments on commit ef61898

Please sign in to comment.