Neos\Flow\Configuration\ConfigurationManager::setPackages PHP Method

setPackages() public method

Sets the active packages to load the configuration for
public setPackages ( array $packages ) : void
$packages array
return void
    public function setPackages(array $packages)
    {
        $this->packages = $packages;
    }

Usage Example

 /**
  * @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);
 }
All Usage Examples Of Neos\Flow\Configuration\ConfigurationManager::setPackages