Skip to content

Commit 8234920

Browse files
committed
[TASK] Replace custom SiteBaseTestTrait implementation
To make frontend requests within functional tests a proper frontend page setup is required, and TYPO3 uses internally a `SiteBasedTestTrait` for own tests, which is not provided in distrubtion packages. Extension created and maintained there own versions, and in some cased tried to make it working against multiple TYPO3 versions. Doing the same work again and again when having multiple extension in the portfolio is a inefficient way. To mitigate this, a dedicated package has been created now to provide it in a central way and maintain it in one place. This change replaces a custom implementation or the usage of the TYPO3 implementation added with a source install of the `EXT:core` system extension making the use easier. The new package is added as development dependency and usage throughout the functional tests are replaced and finaly the custom implementation removed. The package also provides a extended `FunctionalTestCase`, which is also used to prepare for proper SiteSets based functional frontend request testing by overriding a method essential in this case to make it possible **not** to create a `sys_template` record. As a sideeffect we can now remove some phpstan error patterns, which are properly defined and mitigated with the 3rd party package. Used command(s): ```shell Build/Scripts/runTests.sh -p 8.1 -t 12 -s composer -- \ require --dev \ 'sbuerk/typo3-site-based-test-trait':'^1.0.2 || ^2.0.1' \ && Build/Scripts/runTests.sh -p 8.1 -t 12 -s composerUpdate \ && Build/Scripts/runTests.sh -p 8.1 -t 12 -s cgl \ && Build/Scripts/runTests.sh -p 8.1 -t 12 -s phpstanGenerateBaseline \ && Build/Scripts/runTests.sh -p 8.2 -t 13 -s composerUpdate \ && Build/Scripts/runTests.sh -p 8.2 -t 13 -s phpstanGenerateBaseline ```
1 parent e197e4b commit 8234920

16 files changed

+72
-1404
lines changed

Build/phpstan/Core12/phpstan-baseline.neon

Lines changed: 0 additions & 505 deletions
Large diffs are not rendered by default.

Build/phpstan/Core13/phpstan-baseline.neon

Lines changed: 0 additions & 470 deletions
Large diffs are not rendered by default.

Tests/Functional/AbstractDeepLTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
use Psr\Log\NullLogger;
1313
use Ramsey\Uuid\Uuid;
1414
use RuntimeException;
15+
use SBUERK\TYPO3\Testing\TestCase\FunctionalTestCase;
1516
use Symfony\Component\DependencyInjection\Container;
1617
use TYPO3\CMS\Core\Information\Typo3Version;
1718
use TYPO3\CMS\Core\Utility\StringUtility;
18-
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
1919
use WebVision\Deepltranslate\Core\Client;
2020
use WebVision\Deepltranslate\Core\ClientInterface;
2121
use WebVision\Deepltranslate\Core\ConfigurationInterface;

Tests/Functional/Container/ContentElementsInContainerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
88
use PHPUnit\Framework\Attributes\Test;
9+
use SBUERK\TYPO3\Testing\SiteHandling\SiteBasedTestTrait;
910
use TYPO3\CMS\Core\DataHandling\DataHandler;
1011
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
1112
use TYPO3\CMS\Core\Utility\GeneralUtility;
1213
use WebVision\Deepltranslate\Core\Tests\Functional\AbstractDeepLTestCase;
13-
use WebVision\Deepltranslate\Core\Tests\Functional\Fixtures\Traits\SiteBasedTestTrait;
1414

1515
final class ContentElementsInContainerTest extends AbstractDeepLTestCase
1616
{
@@ -84,16 +84,16 @@ protected function setUp(): void
8484

8585
$this->importCSVDataSet(__DIR__ . '/Fixtures/page_with_container.csv');
8686
$this->writeSiteConfiguration(
87-
'acme',
88-
$this->buildSiteConfiguration(1, '/', 'Home'),
89-
[
87+
identifier: 'acme',
88+
site: $this->buildSiteConfiguration(rootPageId: 1),
89+
languages: [
9090
$this->buildDefaultLanguageConfiguration('EN', '/'),
9191
$this->buildLanguageConfiguration('EB', '/eb/', ['EN'], 'strict'),
9292
$this->buildLanguageConfiguration('DE', '/de/', ['EN'], 'strict'),
9393
$this->buildLanguageConfiguration('BS', '/bs/', ['EN'], 'strict'),
94-
]
94+
],
9595
);
96-
$this->setUpFrontendRootPage(1, [], []);
96+
$this->setUpFrontendRootPage(pageId: 1);
9797

9898
$this->setUpBackendUser(1);
9999

Tests/Functional/Fixtures/Frontend/FluidError.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

Tests/Functional/Fixtures/Frontend/FluidJson.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

Tests/Functional/Fixtures/Frontend/PageError.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

Tests/Functional/Fixtures/Frontend/PhpError.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)