diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd2e2c2..1a75421 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,6 +50,12 @@ jobs: typo3-versions: 11 - php-versions: 7.4 typo3-versions: 10 + - php-versions: 8.2 + typo3-versions: 13 + - php-versions: 8.3 + typo3-versions: 13 + - php-versions: 8.4 + typo3-versions: 13 name: Unit Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}) steps: @@ -87,6 +93,13 @@ jobs: matrix: php-versions: [8.2, 8.1] typo3-versions: [12] + include: + - php-versions: 8.2 + typo3-versions: 13 + - php-versions: 8.3 + typo3-versions: 13 + - php-versions: 8.4 + typo3-versions: 13 name: Functional Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}) steps: diff --git a/Classes/ViewHelpers/MediaViewHelper.php b/Classes/ViewHelpers/MediaViewHelper.php index 4e390ed..8ccfcab 100644 --- a/Classes/ViewHelpers/MediaViewHelper.php +++ b/Classes/ViewHelpers/MediaViewHelper.php @@ -89,9 +89,9 @@ public function initializeArguments(): void public function render(): string { $file = $this->arguments['file']; - $additionalConfig = (array)$this->arguments['additionalConfig']; - $width = $this->arguments['width']; - $height = $this->arguments['height']; + $additionalConfig = (array)($this->arguments['additionalConfig'] ?? []); + $width = $this->arguments['width'] ?? ''; + $height = $this->arguments['height'] ?? ''; // get Resource Object (non ExtBase version) if (is_callable([$file, 'getOriginalResource'])) { diff --git a/Tests/Functional/ImageViewHelperTest.php b/Tests/Functional/ImageViewHelperTest.php index a06d59f..a5ae7b4 100644 --- a/Tests/Functional/ImageViewHelperTest.php +++ b/Tests/Functional/ImageViewHelperTest.php @@ -78,11 +78,12 @@ public static function basicScalingCroppingDataProvider(): \Generator 150 ]; // would be 200x150, but image will be stretched (why!?) up to have a width of 250 + // @todo remove multiple possible heights when dropping support for versions before TYPO3 13 yield 'min width' => [ '', - '@^$@', + '@^$@', 250, - 150 + [188, 150] ]; // would be 200x150, but image will be scaled down to have a width of 100 yield 'max width' => [ @@ -92,9 +93,11 @@ public static function basicScalingCroppingDataProvider(): \Generator 75 ]; // would be 200x150, but image will be stretched (why!?) up to have a height of 200 + // @todo remove multiple possible widths when dropping support for versions before TYPO3 13 yield 'min height' => [ '', - '@^$@', + '@^$@', + [267, 200], 200, 200 ]; @@ -108,10 +111,14 @@ public static function basicScalingCroppingDataProvider(): \Generator } /** + * @TODO convert parameters to `int` only when dropping support for versions before TYPO3 13 + * @param int|int[] $expectedWidth + * @param int|int[] $expectedHeight + * * @test * @dataProvider basicScalingCroppingDataProvider */ - public function basicScalingCropping(string $template, string $expected, int $expectedWidth, int $expectedHeight): void + public function basicScalingCropping(string $template, string $expected, $expectedWidth, $expectedHeight): void { $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplateSource('instancePath . '/' . $matches[1]); - self::assertEquals($expectedWidth, $width, 'width of generated image does not match expected width'); - self::assertEquals($expectedHeight, $height, 'height of generated image does not match expected height'); + self::assertContains($width, is_array($expectedWidth) ? $expectedWidth : [$expectedWidth], 'width of generated image does not match expected width'); + self::assertContains($height, is_array($expectedHeight) ? $expectedHeight : [$expectedHeight], 'height of generated image does not match expected height'); } public static function cropVariantCollectionDataProvider(): \Generator diff --git a/composer.json b/composer.json index f3fb07b..cdec7f4 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "issues": "https://github.com/sitegeist/sms-responsive-images/issues" }, "require": { - "typo3/cms-core": "^12.2 || ^11.5 || ^10.4" + "typo3/cms-core": "^13.1 || ^12.2 || ^11.5 || ^10.4" }, "require-dev": { "typo3/testing-framework": "^7.0 || ^6.0 || dev-main", diff --git a/ext_emconf.php b/ext_emconf.php index 9b5a30f..2669f6b 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -12,7 +12,7 @@ 'version' => '3.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-12.9.99', + 'typo3' => '10.4.0-13.9.99', ], 'conflicts' => [ ],