Пример #1
0
 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;
     }
 }
Пример #2
0
 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 testRemoveRootBindingTypeDefinesTypeIfSavingFails()
 {
     $this->initDefaultManager();
     $this->rootPackageFile->addTypeDescriptor($bindingType = new BindingTypeDescriptor('my/type'));
     $this->discovery->expects($this->once())->method('undefineType')->with('my/type');
     $this->discovery->expects($this->once())->method('defineType')->with($bindingType->toBindingType());
     $this->packageFileStorage->expects($this->once())->method('saveRootPackageFile')->with($this->rootPackageFile)->willThrowException(new TestException('Some exception'));
     try {
         $this->manager->removeRootBindingType('my/type');
         $this->fail('Expected an exception');
     } catch (TestException $e) {
     }
     $this->assertSame(array($bindingType), $this->rootPackageFile->getTypeDescriptors());
     $this->assertTrue($bindingType->isEnabled());
 }