Skip to content

Commit dd6f58d

Browse files
committed
[WIP] acceptance tests
1 parent 2c785b4 commit dd6f58d

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

Tests/Acceptance/Support/Extension/BackendContainerEnvironment.php

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use TYPO3\CMS\Core\Information\Typo3Version;
1717
use TYPO3\CMS\Core\Utility\GeneralUtility;
1818
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;
19+
use TYPO3\TestingFramework\Core\Testbase;
1920

2021
class BackendContainerEnvironment extends BackendEnvironment
2122
{
@@ -86,14 +87,38 @@ public function bootstrapTypo3Environment(SuiteEvent $suiteEvent): void
8687
if ($typo3Version->getMajorVersion() < 13) {
8788
return;
8889
}
89-
$content = "<?php
90-
91-
call_user_func(static function () {
92-
\$classLoader = require __DIR__ . '/../../../../../..' . '/vendor/autoload.php';
93-
\TYPO3\TestingFramework\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE);
94-
\TYPO3\CMS\Core\Core\Bootstrap::init(\$classLoader)->get(\TYPO3\CMS\Backend\Http\Application::class)->run();
95-
});";
96-
$instancePath = ORIGINAL_ROOT . 'typo3temp/var/tests/acceptance';
97-
file_put_contents($instancePath . '/typo3/index.php', $content);
90+
$testbase = new Testbase();
91+
$copyFiles = [
92+
// Create favicon.ico to suppress potential javascript errors in console
93+
// which are caused by calling a non html in the browser, e.g. seo sitemap xml
94+
'typo3/sysext/backend/Resources/Public/Icons/favicon.ico' => [
95+
'favicon.ico',
96+
],
97+
// Provide some files into the test instance normally added by installer
98+
'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess' => [
99+
'.htaccess',
100+
],
101+
'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/resources-root-htaccess' => [
102+
'fileadmin/.htaccess',
103+
],
104+
'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess' => [
105+
'fileadmin/_temp_/.htaccess',
106+
],
107+
'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html' => [
108+
'fileadmin/_temp_/index.html',
109+
],
110+
'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess' => [
111+
'typo3temp/var/.htaccess',
112+
],
113+
];
114+
foreach ($copyFiles as $sourceFile => $targetFiles) {
115+
foreach ($targetFiles as $targetFile) {
116+
$testbase->createDirectory(dirname(ltrim($targetFile, '/')));
117+
copy(
118+
from: ltrim($sourceFile, '/'),
119+
to: ltrim($targetFile, '/'),
120+
);
121+
}
122+
}
98123
}
99124
}

0 commit comments

Comments
 (0)