From 4210bfb0c6eeb1b79b7c5a6d25995fdf84ca28fe Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Tue, 16 Apr 2024 17:11:54 +0200 Subject: [PATCH] TASK: Add tests for content block element in container Relates: #20 --- .../Fixtures/{ => Content}/0colDatabase.php | 0 .../0colImageFixWidthDatabase.php | 0 .../{ => Content}/1col2colDatabase.php | 0 .../1col2colFullWidthDatabase.php | 0 ...ol2colWidthContainerMultiplierDatabase.php | 0 .../1col2colWidthContainerSizeDatabase.php | 0 .../Fixtures/{ => Content}/1colDatabase.php | 0 .../{ => Content}/1colFullWidthDatabase.php | 0 .../{ => Content}/2col2colDatabase.php | 0 .../{ => Content}/2col_50_50_Database.php | 0 .../2col_66_33_ImageLeft_Database.php | 0 .../2col_66_33_ImageRight_Database.php | 0 .../Fixtures/{ => Content}/3colDatabase.php | 0 .../3colImageFixWidthDatabase.php | 0 .../Fixtures/ContentBlocks/0colDatabase.php | 11 +++++++++ .../0colImageFixWidthDatabase.php | 11 +++++++++ .../ContentBlocks/1col2colDatabase.php | 11 +++++++++ .../1col2colFullWidthDatabase.php | 11 +++++++++ ...ol2colWidthContainerMultiplierDatabase.php | 11 +++++++++ .../1col2colWidthContainerSizeDatabase.php | 11 +++++++++ .../Fixtures/ContentBlocks/1colDatabase.php | 11 +++++++++ .../ContentBlocks/1colFullWidthDatabase.php | 11 +++++++++ .../ContentBlocks/2col2colDatabase.php | 11 +++++++++ .../ContentBlocks/2col_50_50_Database.php | 11 +++++++++ .../2col_66_33_ImageLeft_Database.php | 11 +++++++++ .../2col_66_33_ImageRight_Database.php | 11 +++++++++ .../Fixtures/ContentBlocks/3colDatabase.php | 11 +++++++++ .../3colImageFixWidthDatabase.php | 11 +++++++++ Tests/Functional/ContainerTest.php | 24 ++++++++++++++++++- 29 files changed, 177 insertions(+), 1 deletion(-) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/0colDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/0colImageFixWidthDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1col2colDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1col2colFullWidthDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1col2colWidthContainerMultiplierDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1col2colWidthContainerSizeDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1colDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/1colFullWidthDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/2col2colDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/2col_50_50_Database.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/2col_66_33_ImageLeft_Database.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/2col_66_33_ImageRight_Database.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/3colDatabase.php (100%) rename Tests/Fixtures/container_example/Test/Fixtures/{ => Content}/3colImageFixWidthDatabase.php (100%) create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/0colDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/0colImageFixWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1col2colDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1col2colFullWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1col2colWidthContainerMultiplierDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1col2colWidthContainerSizeDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1colDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/1colFullWidthDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/2col2colDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/2col_50_50_Database.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/2col_66_33_ImageLeft_Database.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/2col_66_33_ImageRight_Database.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/3colDatabase.php create mode 100644 Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/3colImageFixWidthDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/0colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/0colDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/0colDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/0colDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/0colImageFixWidthDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/0colImageFixWidthDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/0colImageFixWidthDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1col2colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1col2colDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colFullWidthDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1col2colFullWidthDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colFullWidthDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1col2colWidthContainerMultiplierDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colWidthContainerMultiplierDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1col2colWidthContainerMultiplierDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colWidthContainerMultiplierDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1col2colWidthContainerSizeDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colWidthContainerSizeDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1col2colWidthContainerSizeDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1col2colWidthContainerSizeDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1colDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1colDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1colDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/1colFullWidthDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/1colFullWidthDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/1colFullWidthDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/2col2colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/2col2colDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/2col2colDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/2col2colDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/2col_50_50_Database.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/2col_50_50_Database.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/2col_50_50_Database.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/2col_50_50_Database.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/2col_66_33_ImageLeft_Database.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/2col_66_33_ImageLeft_Database.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/2col_66_33_ImageLeft_Database.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/2col_66_33_ImageLeft_Database.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/2col_66_33_ImageRight_Database.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/2col_66_33_ImageRight_Database.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/2col_66_33_ImageRight_Database.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/2col_66_33_ImageRight_Database.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/3colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/3colDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/3colDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/3colDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/Content/3colImageFixWidthDatabase.php similarity index 100% rename from Tests/Fixtures/container_example/Test/Fixtures/3colImageFixWidthDatabase.php rename to Tests/Fixtures/container_example/Test/Fixtures/Content/3colImageFixWidthDatabase.php diff --git a/Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/0colDatabase.php b/Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/0colDatabase.php new file mode 100644 index 0000000..8430b7f --- /dev/null +++ b/Tests/Fixtures/container_example/Test/Fixtures/ContentBlocks/0colDatabase.php @@ -0,0 +1,11 @@ +testExtensionsToLoad = [ 'b13/container', 'codappix/typo3-responsive-images', + 'contentblocks/content-blocks', 'typo3conf/ext/responsive_images/Tests/Fixtures/base_example', 'typo3conf/ext/responsive_images/Tests/Fixtures/container_example', + 'typo3conf/ext/responsive_images/Tests/Fixtures/content_blocks_example', ]; $this->pathsToLinkInTestInstance = [ @@ -60,6 +62,8 @@ protected function setUp(): void 'EXT:base_example/Configuration/TypoScript/Setup.typoscript', 'EXT:base_example/Configuration/TypoScript/Rendering.typoscript', 'EXT:container_example/Configuration/TypoScript/Setup.typoscript', + 'EXT:content_blocks_example/Configuration/TypoScript/ContentElements/codappix_image.typoscript', + 'EXT:content_blocks_example/Configuration/TypoScript/ContentElements/codappix_imagefixedwidth.typoscript', ]); } @@ -211,7 +215,25 @@ public static function imageScalingValuesDataProvider(): iterable #[DataProvider(methodName: 'imageScalingValuesDataProvider')] public function imageIsScaledCorrectly(string $phpDataSet, array $expectedValues): void { - $this->importPHPDataSet(__DIR__ . '/../Fixtures/container_example/Test/Fixtures/' . $phpDataSet); + $this->importPHPDataSet(__DIR__ . '/../Fixtures/container_example/Test/Fixtures/Content/' . $phpDataSet); + + $request = new InternalRequest(); + $request = $request->withPageId(2); + + $result = $this->executeFrontendSubRequest($request); + + self::assertSame(200, $result->getStatusCode()); + + foreach ($expectedValues as $expectedValue) { + self::assertStringContainsString($expectedValue, (string) $result->getBody()); + } + } + + #[Test] + #[DataProvider(methodName: 'imageScalingValuesDataProvider')] + public function contentBlocksImageIsScaledCorrectly(string $phpDataSet, array $expectedValues): void + { + $this->importPHPDataSet(__DIR__ . '/../Fixtures/container_example/Test/Fixtures/ContentBlocks/' . $phpDataSet); $request = new InternalRequest(); $request = $request->withPageId(2);