Fix TwigLintCommandTest failing test

Related to 960931e278

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
Maurício Meneghini Fauth 2025-05-22 09:50:55 -03:00
parent aae1f79b83
commit 521da921e7
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
3 changed files with 26 additions and 11 deletions

View File

@ -16742,6 +16742,11 @@ parameters:
-
message: "#^Method PhpMyAdmin\\\\Encoding\\:\\:convertString\\(\\) should return string but returns string\\|false\\.$#"
count: 2
path: libraries/classes/Encoding.php
-
message: "#^Method PhpMyAdmin\\\\Encoding\\:\\:kanjiStrConv\\(\\) should return string but returns string\\|false\\.$#"
count: 1
path: libraries/classes/Encoding.php

View File

@ -14713,19 +14713,24 @@
</PossiblyInvalidArgument>
</file>
<file src="test/classes/Command/TwigLintCommandTest.php">
<MixedArgument occurrences="2">
<MixedArgument occurrences="3">
<code>$filesFound</code>
<code>$filesFound[1]</code>
<code>$filesInfos</code>
</MixedArgument>
<MixedArrayAccess occurrences="5">
<code>$filesFound[0]['file']</code>
<code>$filesFound[0]['template']</code>
<code>$filesFound[1]['exception']</code>
<code>$filesFound[1]['file']</code>
<code>$filesFound[1]['template']</code>
</MixedArrayAccess>
<MixedAssignment occurrences="4">
<code>$context</code>
<code>$context</code>
<code>$filesFound</code>
<code>$filesInfos</code>
</MixedAssignment>
<PossiblyUndefinedArrayOffset occurrences="1">
<code>$filesFound[0]['exception']</code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="test/classes/CommonTest.php">
<DocblockTypeContradiction occurrences="2">

View File

@ -9,6 +9,7 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use Symfony\Component\Console\Command\Command;
use Twig\Error\SyntaxError;
use function array_multisort;
use function class_exists;
use function sort;
@ -104,14 +105,18 @@ class TwigLintCommandTest extends AbstractTestCase
$filesFound = $twigLintCommand->getFilesInfo($path);
self::assertCount(2, $filesFound);
self::assertSame('{{ file }' . "\n", $filesFound[0]['template']);
self::assertSame($path . '/foo-invalid.twig', $filesFound[0]['file']);
self::assertArrayHasKey('exception', $filesFound[0]);
$exception = $filesFound[0]['exception'];
array_multisort($filesFound);
self::assertSame('{{ file }}' . "\n", $filesFound[0]['template']);
self::assertSame($path . DIRECTORY_SEPARATOR . 'foo-valid.twig', $filesFound[0]['file']);
self::assertSame('{{ file }' . "\n", $filesFound[1]['template']);
self::assertSame($path . DIRECTORY_SEPARATOR . 'foo-invalid.twig', $filesFound[1]['file']);
self::assertArrayHasKey('exception', $filesFound[1]);
$exception = $filesFound[1]['exception'];
self::assertInstanceOf(SyntaxError::class, $exception);
self::assertSame('Unexpected "}" in "' . $path . '/foo-invalid.twig" at line 1.', $exception->getMessage());
self::assertSame('{{ file }}' . "\n", $filesFound[1]['template']);
self::assertSame($path . '/foo-valid.twig', $filesFound[1]['file']);
self::assertSame(
'Unexpected "}" in "' . $path . DIRECTORY_SEPARATOR . 'foo-invalid.twig" at line 1.',
$exception->getMessage()
);
}
public function testGetContext(): void