/** * @return void */ public function setUp() { parent::setUp(); // // create a mock packageManager that only returns the the packages that contain schema files // $schemaPackages = []; $configurationPackages = []; // get all packages and select the ones we want to test $temporaryPackageManager = $this->objectManager->get(PackageManagerInterface::class); foreach ($temporaryPackageManager->getActivePackages() as $package) { if (in_array($package->getPackageKey(), $this->getSchemaPackageKeys())) { $schemaPackages[$package->getPackageKey()] = $package; } if (in_array($package->getPackageKey(), $this->getConfigurationPackageKeys())) { $configurationPackages[$package->getPackageKey()] = $package; } } $this->mockPackageManager = $this->createMock(PackageManager::class); $this->mockPackageManager->expects($this->any())->method('getActivePackages')->will($this->returnValue($schemaPackages)); // // create mock configurationManager and store the original one // $this->originalConfigurationManager = $this->objectManager->get(ConfigurationManager::class); $yamlConfigurationSource = $this->objectManager->get(\Neos\Flow\Tests\Functional\Configuration\Fixtures\RootDirectoryIgnoringYamlSource::class); $this->mockConfigurationManager = clone $this->originalConfigurationManager; $this->mockConfigurationManager->setPackages($configurationPackages); $this->inject($this->mockConfigurationManager, 'configurationSource', $yamlConfigurationSource); $this->objectManager->setInstance(ConfigurationManager::class, $this->mockConfigurationManager); // // create the configurationSchemaValidator // $this->configurationSchemaValidator = $this->objectManager->get(ConfigurationSchemaValidator::class); $this->inject($this->configurationSchemaValidator, 'configurationManager', $this->mockConfigurationManager); }
/** * @test */ public function unfreezePackageEmitsPackageStatesUpdatedSignal() { $this->mockApplicationContext->expects($this->atLeastOnce())->method('isDevelopment')->will($this->returnValue(true)); $this->packageManager->createPackage('Some.Package', ['name' => 'some/package', 'type' => 'neos-package']); $this->packageManager->freezePackage('Some.Package'); $this->mockDispatcher->expects($this->once())->method('dispatch')->with(PackageManager::class, 'packageStatesUpdated'); $this->packageManager->unfreezePackage('Some.Package'); }
/** * Make sure required paths and files are available outside of Package * Run on every Composer install or update - must be configured in root manifest * * @param Event $event * @return void */ public static function postUpdateAndInstall(Event $event) { if (!defined('FLOW_PATH_ROOT')) { define('FLOW_PATH_ROOT', Files::getUnixStylePath(getcwd()) . '/'); } if (!defined('FLOW_PATH_PACKAGES')) { define('FLOW_PATH_PACKAGES', Files::getUnixStylePath(getcwd()) . '/Packages/'); } if (!defined('FLOW_PATH_CONFIGURATION')) { define('FLOW_PATH_CONFIGURATION', Files::getUnixStylePath(getcwd()) . '/Configuration/'); } Files::createDirectoryRecursively('Configuration'); Files::createDirectoryRecursively('Data'); Files::copyDirectoryRecursively('Packages/Framework/Neos.Flow/Resources/Private/Installer/Distribution/Essentials', './', false, true); Files::copyDirectoryRecursively('Packages/Framework/Neos.Flow/Resources/Private/Installer/Distribution/Defaults', './', true, true); $packageManager = new PackageManager(); $packageManager->rescanPackages(); chmod('flow', 0755); }
/** * Get the installed package version (from composer) and as fallback the version given by composer manifest. * * @return string * @api */ public function getInstalledVersion() { return PackageManager::getPackageVersion($this->composerName) ?: $this->getComposerManifest('version'); }