Neos\Flow\Package\PackageManager::freezePackage PHP Method

freezePackage() public method

Freezes a package
public freezePackage ( string $packageKey ) : void
$packageKey string The package to freeze
return void
    public function freezePackage($packageKey)
    {
        if (!$this->bootstrap->getContext()->isDevelopment()) {
            throw new \LogicException('Package freezing is only supported in Development context.', 1338810870);
        }
        if (!$this->isPackageActive($packageKey)) {
            throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available or active.', 1331715956);
        }
        if ($this->isPackageFrozen($packageKey)) {
            return;
        }
        $package = $this->packages[$packageKey];
        $this->bootstrap->getObjectManager()->get(ReflectionService::class)->freezePackageReflection($packageKey);
        $this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen'] = true;
        $this->savePackageStates($this->packageStatesConfiguration);
    }

Usage Example

 /**
  * @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');
 }