예제 #1
0
 public function testDisableBindingRestoresEnabledBindingsIfSavingFails()
 {
     $this->initDefaultManager();
     $this->packageFile1->addTypeDescriptor(new BindingTypeDescriptor('my/type', null, array(new BindingParameterDescriptor('param'))));
     $this->packageFile1->addBindingDescriptor($binding = new BindingDescriptor('/path', 'my/type', array('param' => 'value'), 'xpath'));
     $this->discovery->expects($this->once())->method('unbind')->with('/path', 'my/type', array('param' => 'value'), 'xpath');
     $this->discovery->expects($this->once())->method('bind')->with('/path', 'my/type', array('param' => 'value'), 'xpath');
     $this->packageFileStorage->expects($this->once())->method('saveRootPackageFile')->with($this->rootPackageFile)->willThrowException(new TestException('Some exception'));
     try {
         $this->manager->disableBinding($binding->getUuid());
         $this->fail('Expected an exception');
     } catch (TestException $e) {
     }
     $this->assertSame(array(), $this->installInfo1->getDisabledBindingUuids());
 }
예제 #2
0
 public function testRemoveDisabledBindingUuidIgnoresUnknown()
 {
     $installInfo = new InstallInfo('vendor/package', '/path');
     $uuid = Uuid::uuid4();
     $installInfo->removeDisabledBindingUuid($uuid);
     $this->assertSame(array(), $installInfo->getDisabledBindingUuids());
 }
예제 #3
0
 public function testAddDisabledBindingUuidRemovesEnabledMapping()
 {
     $installInfo = new InstallInfo('vendor/package', '/path');
     $uuid = Uuid::uuid4();
     $installInfo->addEnabledBindingUuid($uuid);
     $installInfo->addDisabledBindingUuid($uuid);
     $this->assertSame(array(), $installInfo->getEnabledBindingUuids());
     $this->assertSame(array($uuid), $installInfo->getDisabledBindingUuids());
 }