/** * Checks if the package autoloader loads classes from packages that match a * substring of another package (e.g. TYPO3CR vs TYPO3). * * @test */ public function classesFromSubMatchingPackagesAreLoaded() { file_put_contents('vfs://Test/Packages/Application/Acme.MyAppAddon/Classes/Class.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>'); self::$testClassWasLoaded = FALSE; $this->classLoader->loadClass('Acme\\MyAppAddon\\Class'); $this->assertTrue(self::$testClassWasLoaded); }
/** * Initializes the package manager * * @param \TYPO3\FLOW3\Core\Bootstrap $bootstrap The current bootstrap * @param string $packagesBasePath Absolute path of the Packages directory * @param string $packageStatesPathAndFilename * @return void */ public function initialize(\TYPO3\FLOW3\Core\Bootstrap $bootstrap, $packagesBasePath = FLOW3_PATH_PACKAGES, $packageStatesPathAndFilename = '') { $this->bootstrap = $bootstrap; $this->packagesBasePath = $packagesBasePath; $this->packageStatesPathAndFilename = $packageStatesPathAndFilename === '' ? FLOW3_PATH_CONFIGURATION . 'PackageStates.php' : $packageStatesPathAndFilename; $this->loadPackageStates(); foreach ($this->packages as $packageKey => $package) { if ($package->isProtected() || isset($this->packageStatesConfiguration['packages'][$packageKey]['state']) && $this->packageStatesConfiguration['packages'][$packageKey]['state'] === 'active') { $this->activePackages[$packageKey] = $package; } } $this->classLoader->setPackages($this->activePackages); foreach ($this->activePackages as $package) { $package->boot($bootstrap); } }