|
1 | | -<?php |
| 1 | +<?php declare(strict_types = 1); |
2 | 2 |
|
3 | | -call_user_func(function () { |
4 | | - $testbase = new \TYPO3\TestingFramework\Core\Testbase(); |
5 | | - $testbase->enableDisplayErrors(); |
6 | | - $testbase->defineBaseConstants(); |
7 | | - $testbase->defineSitePath(); |
8 | | - $testbase->defineTypo3ModeBe(); |
9 | | - $testbase->setTypo3TestingContext(); |
10 | | - $testbase->definePackagesPath(); |
11 | | - $testbase->createDirectory(PATH_site . 'typo3conf/ext'); |
12 | | - $testbase->createDirectory(PATH_site . 'typo3temp/assets'); |
13 | | - $testbase->createDirectory(PATH_site . 'typo3temp/var/tests'); |
14 | | - $testbase->createDirectory(PATH_site . 'typo3temp/var/transient'); |
15 | | - $testbase->createDirectory(PATH_site . 'uploads'); |
| 3 | +// phpcs:disable PSR1.Files.SideEffects |
| 4 | +call_user_func(function (): void { |
| 5 | + // disable TYPO3_DLOG |
| 6 | + define('TYPO3_DLOG', false); |
16 | 7 |
|
17 | | - // disable TYPO3_DLOG |
18 | | - define('TYPO3_DLOG', false); |
| 8 | + $testbase = new \TYPO3\TestingFramework\Core\Testbase(); |
| 9 | + $testbase->enableDisplayErrors(); |
| 10 | + $testbase->defineBaseConstants(); |
| 11 | + $testbase->defineSitePath(); |
| 12 | + $testbase->defineTypo3ModeBe(); |
| 13 | + $testbase->setTypo3TestingContext(); |
| 14 | + $testbase->definePackagesPath(); |
| 15 | + $testbase->createDirectory(PATH_site . 'typo3conf/ext'); |
| 16 | + $testbase->createDirectory(PATH_site . 'typo3temp/assets'); |
| 17 | + $testbase->createDirectory(PATH_site . 'typo3temp/var/tests'); |
| 18 | + $testbase->createDirectory(PATH_site . 'typo3temp/var/transient'); |
| 19 | + $testbase->createDirectory(PATH_site . 'uploads'); |
19 | 20 |
|
20 | | - // Retrieve an instance of class loader and inject to core bootstrap |
21 | | - $classLoaderFilepath = TYPO3_PATH_PACKAGES . 'autoload.php'; |
22 | | - if (!file_exists($classLoaderFilepath)) { |
23 | | - die('ClassLoader can\'t be loaded. Please check your path or set an environment variable \'TYPO3_PATH_ROOT\' to your root path.'); |
24 | | - } |
25 | | - $classLoader = require $classLoaderFilepath; |
26 | | - \TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
27 | | - ->initializeClassLoader($classLoader) |
28 | | - ->setRequestType(TYPO3_REQUESTTYPE_BE | TYPO3_REQUESTTYPE_CLI) |
29 | | - ->baseSetup(); |
| 21 | + // Retrieve an instance of class loader and inject to core bootstrap |
| 22 | + $classLoaderFilepath = TYPO3_PATH_PACKAGES . 'autoload.php'; |
| 23 | + if (!file_exists($classLoaderFilepath)) { |
| 24 | + die('ClassLoader can\'t be loaded. Please check your path or set an environment variable \'TYPO3_PATH_ROOT\' to your root path.'); |
| 25 | + } |
| 26 | + $classLoader = require $classLoaderFilepath; |
| 27 | + \TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
| 28 | + ->initializeClassLoader($classLoader) |
| 29 | + ->setRequestType(TYPO3_REQUESTTYPE_BE | TYPO3_REQUESTTYPE_CLI) |
| 30 | + ->baseSetup(); |
30 | 31 |
|
31 | | - // Initialize default TYPO3_CONF_VARS |
32 | | - $configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager(); |
33 | | - $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration(); |
34 | | - // Avoid failing tests that rely on HTTP_HOST retrieval |
35 | | - $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*'; |
| 32 | + // Initialize default TYPO3_CONF_VARS |
| 33 | + $configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager(); |
| 34 | + $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration(); |
| 35 | + // Avoid failing tests that rely on HTTP_HOST retrieval |
| 36 | + $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*'; |
36 | 37 |
|
37 | | - \TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
38 | | - ->disableCoreCache() |
39 | | - ->initializeCachingFramework() |
40 | | - // Set all packages to active |
41 | | - ->initializePackageManagement(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class); |
| 38 | + \TYPO3\CMS\Core\Core\Bootstrap::getInstance() |
| 39 | + ->disableCoreCache() |
| 40 | + ->initializeCachingFramework() |
| 41 | + // Set all packages to active |
| 42 | + ->initializePackageManagement(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class); |
42 | 43 |
|
43 | | - if (!\TYPO3\CMS\Core\Core\Bootstrap::usesComposerClassLoading()) { |
44 | | - // Dump autoload info if in non composer mode |
45 | | - \TYPO3\CMS\Core\Core\ClassLoadingInformation::dumpClassLoadingInformation(); |
46 | | - \TYPO3\CMS\Core\Core\ClassLoadingInformation::registerClassLoadingInformation(); |
47 | | - } |
| 44 | + if (\TYPO3\CMS\Core\Core\Bootstrap::usesComposerClassLoading()) { |
| 45 | + return; |
| 46 | + } |
| 47 | + |
| 48 | + // Dump autoload info if in non composer mode |
| 49 | + \TYPO3\CMS\Core\Core\ClassLoadingInformation::dumpClassLoadingInformation(); |
| 50 | + \TYPO3\CMS\Core\Core\ClassLoadingInformation::registerClassLoadingInformation(); |
48 | 51 | }); |
0 commit comments