|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +use TYPO3\CMS\Core\Cache\Backend\NullBackend; |
| 4 | +use TYPO3\CMS\Core\Cache\Frontend\PhpFrontend; |
| 5 | +use TYPO3\CMS\Core\Configuration\ConfigurationManager; |
| 6 | +use TYPO3\CMS\Core\Core\Bootstrap; |
| 7 | +use TYPO3\CMS\Core\Core\Environment; |
| 8 | +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; |
| 9 | +use TYPO3\CMS\Core\Package\Cache\PackageCacheInterface; |
| 10 | +use TYPO3\CMS\Core\Package\PackageManager; |
| 11 | +use TYPO3\CMS\Core\Package\UnitTestPackageManager; |
| 12 | +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
| 13 | +use TYPO3\CMS\Core\Utility\GeneralUtility; |
| 14 | +use TYPO3\TestingFramework\Core\Testbase; |
| 15 | + |
3 | 16 | /* |
4 | 17 | * This file is part of the TYPO3 CMS project. |
5 | 18 | * |
|
12 | 25 | * |
13 | 26 | * The TYPO3 project - inspiring people to share! |
14 | 27 | */ |
15 | | - |
16 | 28 | /** |
17 | 29 | * Boilerplate for a unit test phpunit boostrap file. |
18 | 30 | * |
|
28 | 40 | * adapt to extensions needs. |
29 | 41 | */ |
30 | 42 | (static function () { |
31 | | - $testbase = new \TYPO3\TestingFramework\Core\Testbase(); |
| 43 | + $testbase = new Testbase(); |
32 | 44 |
|
33 | 45 | // These if's are for core testing (package typo3/cms) only. cms-composer-installer does |
34 | 46 | // not create the autoload-include.php file that sets these env vars and sets composer |
|
46 | 58 |
|
47 | 59 | $testbase->defineSitePath(); |
48 | 60 |
|
49 | | - $requestType = \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_BE | \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_CLI; |
| 61 | + $requestType = SystemEnvironmentBuilder::REQUESTTYPE_BE | SystemEnvironmentBuilder::REQUESTTYPE_CLI; |
50 | 62 | \TYPO3\TestingFramework\Core\SystemEnvironmentBuilder::run(0, $requestType); |
51 | 63 |
|
52 | | - $testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3conf/ext'); |
53 | | - $testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/assets'); |
54 | | - $testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/tests'); |
55 | | - $testbase->createDirectory(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/typo3temp/var/transient'); |
| 64 | + $testbase->createDirectory(Environment::getPublicPath() . '/typo3conf/ext'); |
| 65 | + $testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/assets'); |
| 66 | + $testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/var/tests'); |
| 67 | + $testbase->createDirectory(Environment::getPublicPath() . '/typo3temp/var/transient'); |
56 | 68 |
|
57 | 69 | // Retrieve an instance of class loader and inject to core bootstrap |
58 | 70 | $classLoader = require $testbase->getPackagesPath() . '/autoload.php'; |
59 | | - \TYPO3\CMS\Core\Core\Bootstrap::initializeClassLoader($classLoader); |
| 71 | + Bootstrap::initializeClassLoader($classLoader); |
60 | 72 |
|
61 | 73 | // Initialize default TYPO3_CONF_VARS |
62 | | - $configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager(); |
| 74 | + $configurationManager = new ConfigurationManager(); |
63 | 75 | $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration(); |
64 | 76 |
|
65 | | - $cache = new \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend( |
| 77 | + $cache = new PhpFrontend( |
66 | 78 | 'core', |
67 | | - new \TYPO3\CMS\Core\Cache\Backend\NullBackend('production', []) |
| 79 | + new NullBackend('production', []) |
68 | 80 | ); |
69 | 81 |
|
70 | 82 | // Set all packages to active |
71 | | - if (interface_exists(\TYPO3\CMS\Core\Package\Cache\PackageCacheInterface::class)) { |
72 | | - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class, \TYPO3\CMS\Core\Core\Bootstrap::createPackageCache($cache)); |
| 83 | + if (interface_exists(PackageCacheInterface::class)) { |
| 84 | + $packageManager = Bootstrap::createPackageManager(UnitTestPackageManager::class, Bootstrap::createPackageCache($cache)); |
73 | 85 | } else { |
74 | 86 | // v10 compatibility layer |
75 | 87 | // @deprecated Will be removed when v10 compat is dropped from testing-framework |
76 | | - $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::createPackageManager(\TYPO3\CMS\Core\Package\UnitTestPackageManager::class, $cache); |
| 88 | + $packageManager = Bootstrap::createPackageManager(UnitTestPackageManager::class, $cache); |
77 | 89 | } |
78 | 90 |
|
79 | | - \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager); |
80 | | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::setPackageManager($packageManager); |
| 91 | + GeneralUtility::setSingletonInstance(PackageManager::class, $packageManager); |
| 92 | + ExtensionManagementUtility::setPackageManager($packageManager); |
81 | 93 |
|
82 | 94 | $testbase->dumpClassLoadingInformation(); |
83 | 95 |
|
84 | | - \TYPO3\CMS\Core\Utility\GeneralUtility::purgeInstances(); |
| 96 | + GeneralUtility::purgeInstances(); |
85 | 97 | })(); |
0 commit comments