diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac4b1ff..f300108 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,21 +13,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '7.4', '8.0', '8.1' ] - TYPO3: [ '11' ] - include: - - TYPO3: '10' - php: '7.4' - - TYPO3: '12' - php: '8.1' + php: [ '8.3' ] + TYPO3: [ '11', '12' , '13' ] + steps: - name: Checkout uses: actions/checkout@v2 - - name: Patch 10 - if: matrix.TYPO3 == '10' - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s patchV10 - - name: Install testing system run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s composerInstall @@ -41,7 +33,7 @@ jobs: run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s cgl -n - name: phpstan - run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s phpstan + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s phpstan - name: Unit Tests run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s unit diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 13a1781..3d38b37 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -241,12 +241,6 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? docker-compose down ;; - patchV10) - setUpDockerComposeDotEnv - docker-compose run patchV10 - SUITE_EXIT_CODE=$? - docker-compose down - ;; functional) setUpDockerComposeDotEnv case ${DBMS} in diff --git a/Build/phpstan11.neon b/Build/phpstan11.neon new file mode 100644 index 0000000..800330e --- /dev/null +++ b/Build/phpstan11.neon @@ -0,0 +1,7 @@ +parameters: + level: 5 + + paths: + - %currentWorkingDirectory%/Classes + ignoreErrors: + - '#.*unknown class TYPO3\\CMS\\Core\\TypoScript\\FrontendTypoScript.#' diff --git a/Build/phpunit/UnitTestsBootstrap.php b/Build/phpunit/UnitTestsBootstrap.php index 9e9222f..80aad99 100644 --- a/Build/phpunit/UnitTestsBootstrap.php +++ b/Build/phpunit/UnitTestsBootstrap.php @@ -12,28 +12,12 @@ * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Core\Information\Typo3Version; - call_user_func(function () { if (!class_exists(\TYPO3\CMS\Frontend\Page\PageRepository::class)) { class_alias(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class, \TYPO3\CMS\Frontend\Page\PageRepository::class); } $testbase = new \TYPO3\TestingFramework\Core\Testbase(); - // These if's are for core testing (package typo3/cms) only. cms-composer-installer does - // not create the autoload-include.php file that sets these env vars and sets composer - // mode to true. testing-framework can not be used without composer anyway, so it is safe - // to do this here. This way it does not matter if 'bin/phpunit' or 'vendor/phpunit/phpunit/phpunit' - // is called to run the tests since the 'relative to entry script' path calculation within - // SystemEnvironmentBuilder is not used. However, the binary must be called from the document - // root since getWebRoot() uses 'getcwd()'. - if (!getenv('TYPO3_PATH_ROOT')) { - putenv('TYPO3_PATH_ROOT=' . rtrim($testbase->getWebRoot(), '/')); - } - if (!getenv('TYPO3_PATH_WEB')) { - putenv('TYPO3_PATH_WEB=' . rtrim($testbase->getWebRoot(), '/')); - } - $testbase->defineSitePath(); $requestType = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI; @@ -56,18 +40,12 @@ class_alias(\TYPO3\CMS\Core\Domain\Repository\PageRepository::class, \TYPO3\CMS\ 'core', new \TYPO3\CMS\Core\Cache\Backend\NullBackend('production', []) ); - // Set all packages to active - if (version_compare((new Typo3Version())->getVersion(), '11.3.0', '>')) { - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( - \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, - \TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache) - ); - } else { - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( - \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, - $cache - ); - } + + $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager( + \TYPO3\CMS\Core\Package\UnitTestPackageManager::class, + \TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache) + ); + \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager); diff --git a/Build/testing-docker/docker-compose.yml b/Build/testing-docker/docker-compose.yml index 747376e..79d01d2 100644 --- a/Build/testing-docker/docker-compose.yml +++ b/Build/testing-docker/docker-compose.yml @@ -83,12 +83,11 @@ services: fi php -v | grep '^PHP'; if [ ${TYPO3} -eq 11 ]; then - composer install --no-progress --no-interaction - elif [ ${TYPO3} -eq 10 ]; then - composer require friendsofphp/php-cs-fixer:~3.9.0 typo3/cms-fluid:^10.4 typo3/testing-framework:^6 --dev -W --no-progress --no-interaction - composer prepare-tests-10 - else + composer require typo3/cms-fluid:^11.5 --dev -W --no-progress --no-interaction + elif [ ${TYPO3} -eq 12 ]; then composer require typo3/cms-fluid:^12.4 --dev -W --no-progress --no-interaction + else + composer install --dev --no-progress --no-interaction fi " @@ -165,23 +164,6 @@ services: find . -name \\*.php ! -path "./.Build/\\*" -print0 | xargs -0 -n1 -P4 php -dxdebug.mode=off -l >/dev/null " - patchV10: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest - user: ${HOST_UID} - volumes: - - ${ROOT_DIR}:${ROOT_DIR} - - ${HOST_HOME}:${HOST_HOME} - - /etc/passwd:/etc/passwd:ro - - /etc/group:/etc/group:ro - working_dir: ${ROOT_DIR} - command: > - /bin/sh -c " - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)testExtensionsToLoad = \[/protected \1testExtensionsToLoad = [/g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected bool \(.*\)resetSingletonInstances = /protected \1resetSingletonInstances = /g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)coreExtensionsToLoad = \[/protected \1coreExtensionsToLoad = [/g'; - find Tests -name \\*.php -print0 | xargs -0 sed -i 's/protected array \(.*\)pathsToLinkInTestInstance = \[/protected \1pathsToLinkInTestInstance = [/g'; - " - phpstan: image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest user: ${HOST_UID} @@ -197,7 +179,11 @@ services: set -x fi php -v | grep '^PHP'; + if [ ${TYPO3} -eq 11 ]; then + php -dxdebug.mode=off .Build/bin/phpstan analyze -c Build/phpstan11.neon --no-progress --no-interaction + else php -dxdebug.mode=off .Build/bin/phpstan analyze -c Build/phpstan.neon --no-progress --no-interaction + fi " unit: diff --git a/Classes/Domain/Model/PictureConfiguration.php b/Classes/Domain/Model/PictureConfiguration.php index 58abee7..976aaf4 100644 --- a/Classes/Domain/Model/PictureConfiguration.php +++ b/Classes/Domain/Model/PictureConfiguration.php @@ -54,7 +54,7 @@ public function __construct(array $arguments, array $typoScriptSettings, FileInt $this->lazyLoading = (string)$typoScriptSettings['lazyLoading']; } // do not add retina images for elements with variants (the browser should select the best-sized image) - if(!empty($arguments['sizes'])) { + if (!empty($arguments['sizes'])) { $this->useRetina = false; } } diff --git a/Classes/ViewHelpers/ImageViewHelper.php b/Classes/ViewHelpers/ImageViewHelper.php index 5551edd..8bc7798 100644 --- a/Classes/ViewHelpers/ImageViewHelper.php +++ b/Classes/ViewHelpers/ImageViewHelper.php @@ -13,9 +13,12 @@ */ use B13\Picture\Domain\Model\PictureConfiguration; +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Resource\FileInterface; use TYPO3\CMS\Core\Resource\ProcessedFile; +use TYPO3\CMS\Core\TypoScript\FrontendTypoScript; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Extbase\Service\ImageService; @@ -461,13 +464,29 @@ protected function buildOutput(array $output): string protected function getTypoScriptSettings(): array { $settings = []; - $frontendController = $this->getFrontendController(); - if ($frontendController instanceof TypoScriptFrontendController) { - $settings = $frontendController->tmpl->setup['plugin.']['tx_picture.'] ?? []; + if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) { + $frontendController = $this->getFrontendController(); + if ($frontendController instanceof TypoScriptFrontendController) { + $settings = $frontendController->tmpl->setup['plugin.']['tx_picture.'] ?? []; + } + return $settings; + } + $request = $this->getServerRequest(); + if ($request === null) { + return $settings; } + /** @var FrontendTypoScript $typoScript */ + $typoScript = $request->getAttribute('frontend.typoscript'); + $setup = $typoScript->getSetupArray(); + $settings = $setup['plugin.']['tx_picture.'] ?? []; return $settings; } + protected function getServerRequest(): ?ServerRequestInterface + { + return $GLOBALS['TYPO3_REQUEST'] ?? null; + } + protected function getFrontendController(): ?TypoScriptFrontendController { if (($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController) { diff --git a/Tests/Functional/Frontend/AbstractFrontendTest.php b/Tests/Functional/Frontend/AbstractFrontendTest.php deleted file mode 100644 index ef234d0..0000000 --- a/Tests/Functional/Frontend/AbstractFrontendTest.php +++ /dev/null @@ -1,32 +0,0 @@ - 'typo3conf/sites']; - protected array $testExtensionsToLoad = ['typo3conf/ext/picture']; - - protected function executeFrontendRequestWrapper(InternalRequest $request, InternalRequestContext $context = null, bool $followRedirects = false): ResponseInterface - { - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() < 11) { - return $this->executeFrontendRequest($request, $context, $followRedirects); - } - return $this->executeFrontendSubRequest($request, $context, $followRedirects); - } -} diff --git a/Tests/Functional/Frontend/DemonstrationPageTest.php b/Tests/Functional/Frontend/DemonstrationPageTest.php index 40c2ce7..0e2a6ec 100644 --- a/Tests/Functional/Frontend/DemonstrationPageTest.php +++ b/Tests/Functional/Frontend/DemonstrationPageTest.php @@ -12,11 +12,14 @@ * of the License, or any later version. */ -use B13\Picture\Tests\Functional\Functional\AbstractFrontendTest; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class ImageViewHelperTest extends AbstractFrontendTest +class DemonstrationPageTest extends FunctionalTestCase { + protected array $pathsToLinkInTestInstance = ['typo3conf/ext/picture/Build/sites' => 'typo3conf/sites']; + protected array $testExtensionsToLoad = ['typo3conf/ext/picture']; + /** * @test */ @@ -30,7 +33,7 @@ public function callingPageReturns200ResponseCode(): void 'setup' => ['EXT:picture/Configuration/TypoScript/test.typoscript'], ] ); - $response = $this->executeFrontendRequest(new InternalRequest('/?type=1573387706874')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/?type=1573387706874')); $status = $response->getStatusCode(); self::assertSame(200, $status); } diff --git a/Tests/Functional/Frontend/Fixtures/Templates/SimpleImage.html b/Tests/Functional/Frontend/Fixtures/Templates/SimpleImage.html index 76eeedc..0fc665d 100644 --- a/Tests/Functional/Frontend/Fixtures/Templates/SimpleImage.html +++ b/Tests/Functional/Frontend/Fixtures/Templates/SimpleImage.html @@ -5,4 +5,4 @@ > - \ No newline at end of file + diff --git a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sizes.csv b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sizes.csv index 6278082..17d958c 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sizes.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sizes.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithMultipleSizes.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources.csv b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources.csv index 0e20f5c..7105a1f 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithMultipleSources.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources_with_webp_option.csv b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources_with_webp_option.csv index 6c22341..491b4bb 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources_with_webp_option.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_multiple_sources_with_webp_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithMultipleSourcesWithWebpOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_picture_class.csv b/Tests/Functional/Frontend/Fixtures/image_with_picture_class.csv index 4e7d832..973dbe6 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_picture_class.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_picture_class.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithPictureClass.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_srcset_and_a_sizes_value_with_webp_option.csv b/Tests/Functional/Frontend/Fixtures/image_with_srcset_and_a_sizes_value_with_webp_option.csv index c761e57..77c41e0 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_srcset_and_a_sizes_value_with_webp_option.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_srcset_and_a_sizes_value_with_webp_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithSrcsetAndASizesValueWithWebpOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_three_sizes_for_three_given_breakpoints.csv b/Tests/Functional/Frontend/Fixtures/image_with_three_sizes_for_three_given_breakpoints.csv index 580bd29..bf96e37 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_three_sizes_for_three_given_breakpoints.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_three_sizes_for_three_given_breakpoints.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithThreeSizesForThreeGivenBreakpoints.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/image_with_two_sizes_and_retina_option.csv b/Tests/Functional/Frontend/Fixtures/image_with_two_sizes_and_retina_option.csv index cb4037a..e7a1e67 100644 --- a/Tests/Functional/Frontend/Fixtures/image_with_two_sizes_and_retina_option.csv +++ b/Tests/Functional/Frontend/Fixtures/image_with_two_sizes_and_retina_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = ImageWithTwoSizesAndRetinaOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/simple_image.csv b/Tests/Functional/Frontend/Fixtures/simple_image.csv index 4c01937..d14b27c 100644 --- a/Tests/Functional/Frontend/Fixtures/simple_image.csv +++ b/Tests/Functional/Frontend/Fixtures/simple_image.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SimpleImage.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/simple_image_as_webp.csv b/Tests/Functional/Frontend/Fixtures/simple_image_as_webp.csv index 983a9ed..f71daa2 100644 --- a/Tests/Functional/Frontend/Fixtures/simple_image_as_webp.csv +++ b/Tests/Functional/Frontend/Fixtures/simple_image_as_webp.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SimpleImageAsWebp.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_and_webp_option.csv b/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_and_webp_option.csv index 535e13d..aaecda1 100644 --- a/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_and_webp_option.csv +++ b/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_and_webp_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SimpleImageWithRetinaAndWebpOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_option.csv b/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_option.csv index 370edce..4229b94 100644 --- a/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_option.csv +++ b/Tests/Functional/Frontend/Fixtures/simple_image_with_retina_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SimpleImageWithRetinaOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/simple_image_with_webp_option.csv b/Tests/Functional/Frontend/Fixtures/simple_image_with_webp_option.csv index 6d6bb81..9f3be78 100644 --- a/Tests/Functional/Frontend/Fixtures/simple_image_with_webp_option.csv +++ b/Tests/Functional/Frontend/Fixtures/simple_image_with_webp_option.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SimpleImageWithWebpOption.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_and_two_breakpoints.csv b/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_and_two_breakpoints.csv index d649f77..c05505a 100644 --- a/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_and_two_breakpoints.csv +++ b/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_and_two_breakpoints.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SingleImageWithMultipleImageSizesAndTwoBreakpoints.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_as_srcset.csv b/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_as_srcset.csv index 4a43a50..f7c95b0 100644 --- a/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_as_srcset.csv +++ b/Tests/Functional/Frontend/Fixtures/single_image_with_multiple_image_sizes_as_srcset.csv @@ -9,4 +9,5 @@ page.config.disableAllHeaderCode = 1 page.10 = FLUIDTEMPLATE page.10.templateRootPaths.10 = EXT:picture/Tests/Functional/Frontend/Fixtures/Templates page.10.templateName = SingleImageWithMultipleImageSizesAsSrcset.html -" \ No newline at end of file +config.absRefPrefix = / +" diff --git a/Tests/Functional/Frontend/TagRenderingTest.php b/Tests/Functional/Frontend/TagRenderingTest.php index 9f25b39..17393af 100644 --- a/Tests/Functional/Frontend/TagRenderingTest.php +++ b/Tests/Functional/Frontend/TagRenderingTest.php @@ -12,11 +12,11 @@ * of the License, or any later version. */ -use B13\Picture\Tests\Functional\Functional\AbstractFrontendTest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest; +use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; -class TagRenderingTest extends AbstractFrontendTest +class TagRenderingTest extends FunctionalTestCase { protected array $pathsToLinkInTestInstance = ['typo3conf/ext/picture/Build/sites' => 'typo3conf/sites']; protected array $testExtensionsToLoad = ['typo3conf/ext/picture']; @@ -27,7 +27,7 @@ class TagRenderingTest extends AbstractFrontendTest public function simpleImage(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/simple_image.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = 'Testimage 400px width'; self::assertStringContainsString($this->anonymouseProcessdImage($expected), $this->anonymouseProcessdImage($body)); @@ -39,7 +39,7 @@ public function simpleImage(): void public function simpleImageAsWebp(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/simple_image_as_webp.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = 'Testimage 400px width'; self::assertStringContainsString($this->anonymouseProcessdImage($expected), $this->anonymouseProcessdImage($body)); @@ -51,7 +51,7 @@ public function simpleImageAsWebp(): void public function simpleImageWithRetinaOption(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/simple_image_with_retina_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = 'Testimage 400px width with retina optionimportCSVDataSet(__DIR__ . '/Fixtures/simple_image_with_webp_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -86,7 +86,7 @@ public function simpleImageWithWebpOption(): void public function simpleImageWithRetinaAndWebpOption(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/simple_image_with_retina_and_webp_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -102,7 +102,7 @@ public function simpleImageWithRetinaAndWebpOption(): void public function imageWithMultipleSizes(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_multiple_sizes.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -119,7 +119,7 @@ public function imageWithMultipleSizes(): void public function imageWithTwoSizesAndRetinaOption(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_two_sizes_and_retina_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -136,7 +136,7 @@ public function imageWithTwoSizesAndRetinaOption(): void public function singleImageWithMultipleImageSizesAndTwoBreakpoints(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/single_image_with_multiple_image_sizes_and_two_breakpoints.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -152,7 +152,7 @@ public function singleImageWithMultipleImageSizesAndTwoBreakpoints(): void public function singleImageWithMultipleImageSizesAsSrcset(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/single_image_with_multiple_image_sizes_as_srcset.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = 'Testimage with 400px image size, with multiple images as a srcset, including webp image format with fallbackimportCSVDataSet(__DIR__ . '/Fixtures/image_with_srcset_and_a_sizes_value_with_webp_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -190,7 +190,7 @@ public function imageWithSrcsetAndASizesValueWithWebpOption(): void public function imageWithThreeSizesForThreeGivenBreakpoints(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_three_sizes_for_three_given_breakpoints.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -208,7 +208,7 @@ public function imageWithThreeSizesForThreeGivenBreakpoints(): void public function imageWithPictureClassRenderPictureTag(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_picture_class.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ''; self::assertStringContainsString($expected, $body); @@ -217,7 +217,7 @@ public function imageWithPictureClassRenderPictureTag(): void public function imageWithMultipleSources(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_multiple_sources.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' @@ -234,7 +234,7 @@ public function imageWithMultipleSources(): void public function imageWithMultipleSourcesWithWebPOption(): void { $this->importCSVDataSet(__DIR__ . '/Fixtures/image_with_multiple_sources_with_webp_option.csv'); - $response = $this->executeFrontendRequestWrapper(new InternalRequest('http://localhost/')); + $response = $this->executeFrontendSubRequest(new InternalRequest('http://localhost/')); $body = (string)$response->getBody(); $expected = ' diff --git a/Tests/Functional/ViewHelpers/ImageViewHelperTest.php b/Tests/Functional/ViewHelpers/ImageViewHelperTest.php index 40d28c5..ffecaa4 100644 --- a/Tests/Functional/ViewHelpers/ImageViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/ImageViewHelperTest.php @@ -12,6 +12,7 @@ * of the License, or any later version. */ +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Type\File\ImageInfo; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -69,14 +70,14 @@ protected function assertProcessedFileExists(int $width, int $height): void ->where( $queryBuilder->expr()->eq( 'width', - $queryBuilder->createNamedParameter($width, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($width, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 'height', - $queryBuilder->createNamedParameter($height, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($height, Connection::PARAM_INT) ) ) - ->execute() + ->executeQuery() ->fetchAssociative(); self::assertTrue($row !== false, 'row with width: ' . $width . ' and height: ' . $height . ' not found'); $filePath = GeneralUtility::getFileAbsFileName($this->fileadmin . $row['identifier']); diff --git a/composer.json b/composer.json index c2ef3af..38d5d6b 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,7 @@ } }, "require": { - "php": "^7.4 || ~8.0", - "typo3/cms-fluid": "^10.4 || ^11.5 || ^12.4" + "typo3/cms-fluid": "^11.5 || ^12.4 || ^13.1" }, "autoload": { "psr-4": { @@ -21,12 +20,11 @@ } }, "require-dev": { - "phpstan/phpstan": "^1.8.11", - "phpunit/phpunit": "^9.5", - "typo3/cms-fluid": "^11.5", - "typo3/coding-standards": "^0.5", + "typo3/cms-fluid": "^11.5 || ^12.4 || ^13.1", + "saschaegerer/phpstan-typo3": "^1.8", + "typo3/coding-standards": "^0.5.5", "typo3/tailor": "^1.1", - "typo3/testing-framework": "^7" + "typo3/testing-framework": "^7.0 || ^8.0" }, "config": { "vendor-dir": ".Build/vendor",