/** * {@inheritdoc} */ public function rollback() { // sanity check if ($this->typeDescriptor->isLoaded() || !$this->containingModule) { return; } // never fails with the check before $this->typeDescriptor->load($this->containingModule); if ($this->wasRemoved) { // never fails $this->typeDescriptors->add($this->typeDescriptor); } }
/** * {@inheritdoc} */ public function rollback() { // sanity check if (!$this->typeDescriptor->isLoaded()) { return; } $typeName = $this->typeDescriptor->getTypeName(); // never fails with the check before $this->typeDescriptor->unload(); if ($this->previousDescriptor && $this->previousDescriptor->isLoaded()) { // never fails $this->typeDescriptors->add($this->previousDescriptor); } else { // never fails $this->typeDescriptors->remove($typeName, $this->containingPackage->getName()); } }
private function refreshState() { if (null === $this->typeDescriptor || !$this->typeDescriptor->isLoaded()) { $this->state = BindingState::TYPE_NOT_FOUND; } elseif (!$this->typeDescriptor->isEnabled()) { $this->state = BindingState::TYPE_NOT_ENABLED; } elseif (count($this->loadErrors) > 0) { $this->state = BindingState::INVALID; } elseif ($this->containingModule instanceof RootModule) { $this->state = BindingState::ENABLED; } elseif ($this->containingModule->getInstallInfo()->hasDisabledBindingUuid($this->binding->getUuid())) { $this->state = BindingState::DISABLED; } else { $this->state = BindingState::ENABLED; } }
private function refreshState() { if (null === $this->typeDescriptor || !$this->typeDescriptor->isLoaded()) { $this->state = BindingState::TYPE_NOT_FOUND; } elseif (!$this->typeDescriptor->isEnabled()) { $this->state = BindingState::TYPE_NOT_ENABLED; } elseif (count($this->violations) > 0) { $this->state = BindingState::INVALID; } elseif ($this->containingPackage instanceof RootPackage) { $this->state = BindingState::ENABLED; } elseif ($this->containingPackage->getInstallInfo()->hasDisabledBindingUuid($this->uuid)) { $this->state = BindingState::DISABLED; } else { $this->state = BindingState::ENABLED; } }
public function testClearRootBindingTypes() { $this->initDefaultManager(); $this->rootPackageFile->addTypeDescriptor($bindingType1 = new BindingTypeDescriptor('my/type1')); $this->rootPackageFile->addTypeDescriptor($bindingType2 = new BindingTypeDescriptor('my/type2')); $this->discovery->expects($this->at(0))->method('undefineType')->with('my/type1'); $this->discovery->expects($this->at(1))->method('undefineType')->with('my/type2'); $this->packageFileStorage->expects($this->once())->method('saveRootPackageFile')->with($this->rootPackageFile)->will($this->returnCallback(function (RootPackageFile $rootPackageFile) { PHPUnit_Framework_Assert::assertFalse($rootPackageFile->hasTypeDescriptors()); })); $this->manager->clearRootBindingTypes(); $this->assertFalse($bindingType1->isLoaded()); $this->assertFalse($bindingType2->isLoaded()); }