Merge branch 'QA_5_2'

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
Maurício Meneghini Fauth 2025-05-10 15:41:10 -03:00
commit 144f13a38d
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
6 changed files with 26 additions and 33 deletions

View File

@ -9593,9 +9593,11 @@
<code><![CDATA[$context]]></code>
<code><![CDATA[$context]]></code>
<code><![CDATA[$filesFound]]></code>
<code><![CDATA[$filesFound]]></code>
<code><![CDATA[$filesInfos]]></code>
</MixedAssignment>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$filesFound[0]['exception']]]></code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="tests/unit/Config/ConfigFileTest.php">
<MixedArrayAccess>

View File

@ -432,7 +432,14 @@ class OlVisualization extends GisVisualization {
return undefined;
}
$('head').append('<link rel="stylesheet" type="text/css" href="js/vendor/openlayers/theme/ol.css">');
const olCss = 'js/vendor/openlayers/theme/ol.css';
if (! document.querySelector('link[rel="stylesheet"][href="' + olCss + '"]')) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = olCss;
document.head.appendChild(link);
}
const vectorSource = new window.ol.source.Vector({
features: getFeaturesFromOpenLayersData(this.data),

View File

@ -139,7 +139,7 @@ class TwigLintCommand extends Command
}
/** @return array{template: string, file: string, exception?:Error}[] */
protected function getFilesInfo(string $templatesPath): array
public function getFilesInfo(string $templatesPath): array
{
$filesInfo = [];
$filesFound = $this->findFiles($templatesPath);

View File

@ -10,7 +10,6 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Console\Command\Command;
use Twig\Error\SyntaxError;
use Twig\Source;
use function class_exists;
use function sort;
@ -86,36 +85,19 @@ class TwigLintCommandTest extends AbstractTestCase
public function testGetFilesInfoInvalidFile(): void
{
$command = $this->getMockBuilder(TwigLintCommand::class)
->onlyMethods(['getTemplateContents', 'findFiles'])
->getMock();
$twigLintCommand = new TwigLintCommand();
$path = __DIR__ . '/../_data/templates/lint_command';
$filesFound = $twigLintCommand->getFilesInfo($path);
$command->expects(self::exactly(1))
->method('findFiles')
->willReturn(
['foo.twig', 'foo-invalid.twig'],
);
$command->expects(self::exactly(2))->method('getTemplateContents')->willReturnMap([
['foo.twig', '{{ file }}'],
['foo-invalid.twig', '{{ file }'],
]);
$filesFound = $this->callFunction($command, TwigLintCommand::class, 'getFilesInfo', [
__DIR__ . '/../_data/file_listing',
]);
self::assertEquals([
['template' => '{{ file }}', 'file' => 'foo.twig'],
[
'template' => '{{ file }',
'file' => 'foo-invalid.twig',
'exception' => new SyntaxError('Unexpected "}".', 1, new Source(
'{{ file }',
'foo-invalid.twig',
)),
],
], $filesFound);
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'];
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']);
}
public function testGetContext(): void

View File

@ -0,0 +1 @@
{{ file }

View File

@ -0,0 +1 @@
{{ file }}