Skip to content

Commit

Permalink
TASK: Add tests for content block element in container
Browse files Browse the repository at this point in the history
  • Loading branch information
d-g-codappix committed Jun 12, 2024
1 parent bf463ca commit 12488c3
Show file tree
Hide file tree
Showing 29 changed files with 177 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_imagefixedwidth';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][1]['CType'] = 'codappix_image';

return $configuration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

$pathinfo = pathinfo(__FILE__);
$path = $pathinfo['dirname'] . '/../Content/' . $pathinfo['basename'];
$configuration = include $path;

$configuration['tt_content'][2]['CType'] = 'codappix_imagefixedwidth';

return $configuration;
24 changes: 23 additions & 1 deletion Tests/Functional/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ protected function setUp(): void
$this->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 = [
Expand All @@ -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',
]);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 12488c3

Please sign in to comment.