From 2c45f7dcc29ae1c7c8e9f9e8e678e6f8319dfadc Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Thu, 23 Apr 2026 11:27:42 +0200 Subject: [PATCH 1/2] [TASK] prevent deprecations --- Build/phpunit/FunctionalTests.xml | 2 +- Classes/ViewHelpers/ImageViewHelper.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Build/phpunit/FunctionalTests.xml b/Build/phpunit/FunctionalTests.xml index 1310e09..79f6e2e 100644 --- a/Build/phpunit/FunctionalTests.xml +++ b/Build/phpunit/FunctionalTests.xml @@ -10,7 +10,7 @@ stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" failOnWarning="true" - failOnDeprecation="false" + failOnDeprecation="true" > diff --git a/Classes/ViewHelpers/ImageViewHelper.php b/Classes/ViewHelpers/ImageViewHelper.php index 405fad5..efee355 100644 --- a/Classes/ViewHelpers/ImageViewHelper.php +++ b/Classes/ViewHelpers/ImageViewHelper.php @@ -41,7 +41,7 @@ public function __construct() public function initializeArguments(): void { parent::initializeArguments(); - if ((new Typo3Version())->getMajorVersion() < 14) { + if ((new Typo3Version())->getMajorVersion() < 13) { $this->registerUniversalTagAttributes(); // attributes from fluid VH $this->registerTagAttribute('alt', 'string', 'Specifies an alternate text for an image', false); @@ -291,7 +291,7 @@ protected function buildSingleTag(string $tagName, array $configuration, FileInt $tag->addAttribute('loading', $this->pictureConfiguration->getLazyLoading()); } - if ((new Typo3Version())->getMajorVersion() < 14) { + if ((new Typo3Version())->getMajorVersion() < 13) { $alt = $this->arguments['alt'] ?? $image->getProperty('alternative'); $title = $this->arguments['title'] ?? $image->getProperty('title'); } else { From b3d00efeedf7605ccd7e0d3c70a8a63863539809 Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Thu, 23 Apr 2026 11:40:35 +0200 Subject: [PATCH 2/2] [TASK] test additional arguments Relates to: #91 --- .../SimpleImageWithAdditionalAttributes.html | 8 ++++++++ .../simple_image_with_additional_attributes.csv | 13 +++++++++++++ Tests/Functional/Frontend/TagRenderingTest.php | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 Tests/Functional/Frontend/Fixtures/Templates/SimpleImageWithAdditionalAttributes.html create mode 100644 Tests/Functional/Frontend/Fixtures/simple_image_with_additional_attributes.csv diff --git a/Tests/Functional/Frontend/Fixtures/Templates/SimpleImageWithAdditionalAttributes.html b/Tests/Functional/Frontend/Fixtures/Templates/SimpleImageWithAdditionalAttributes.html new file mode 100644 index 0000000..2650d2a --- /dev/null +++ b/Tests/Functional/Frontend/Fixtures/Templates/SimpleImageWithAdditionalAttributes.html @@ -0,0 +1,8 @@ + + + + diff --git a/Tests/Functional/Frontend/Fixtures/simple_image_with_additional_attributes.csv b/Tests/Functional/Frontend/Fixtures/simple_image_with_additional_attributes.csv new file mode 100644 index 0000000..f4fee18 --- /dev/null +++ b/Tests/Functional/Frontend/Fixtures/simple_image_with_additional_attributes.csv @@ -0,0 +1,13 @@ +"pages" +,"uid","pid","title","slug" +,1,0,"root","/" +"sys_template" +,"uid","pid","root","constants","config" +,1,1,1,styles.content.image.lazyLoading=lazy,"@import 'EXT:picture/Configuration/TypoScript/test.typoscript' +page = PAGE +page.config.disableAllHeaderCode = 1 +page.10 = FLUIDTEMPLATE +page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates +page.10.templateName = SimpleImageWithAdditionalAttributes.html +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/TagRenderingTest.php b/Tests/Functional/Frontend/TagRenderingTest.php index c550d94..d763714 100644 --- a/Tests/Functional/Frontend/TagRenderingTest.php +++ b/Tests/Functional/Frontend/TagRenderingTest.php @@ -34,6 +34,16 @@ public function simpleImage(): void self::assertStringContainsString($this->anonymouseProcessdImage($expected), $this->anonymouseProcessdImage($body)); } + #[Test] + public function simpleImageWithAdditionalAttributes(): void + { + $this->importCSVDataSet(__DIR__ . '/Fixtures/simple_image_with_additional_attributes.csv'); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); + $body = (string)$response->getBody(); + $expected = 'Testimage 400px width'; + self::assertStringContainsString($this->anonymouseProcessdImage($expected), $this->anonymouseProcessdImage($body)); + } + #[Test] public function simpleImageAsWebp(): void {