public function testRemoveRootInstallerDescriptorsRestoresPreviousInstallersIfSavingFails()
 {
     $this->rootPackageFile->setExtraKey(AssetPlugin::INSTALLERS_KEY, (object) array('symlink' => (object) array('class' => 'SymlinkInstaller'), 'cdn' => (object) array('class' => 'CdnInstaller')));
     $this->packageFileManager->expects($this->once())->method('setExtraKey')->with(AssetPlugin::INSTALLERS_KEY, (object) array('cdn' => (object) array('class' => 'CdnInstaller')))->willThrowException(new TestException());
     try {
         $this->manager->removeRootInstallerDescriptors(Expr::startsWith('symlink', InstallerDescriptor::NAME));
         $this->fail('Expected a TestException');
     } catch (TestException $e) {
     }
     $this->assertEquals((object) array('symlink' => (object) array('class' => 'SymlinkInstaller'), 'cdn' => (object) array('class' => 'CdnInstaller')), $this->rootPackageFile->getExtraKey(AssetPlugin::INSTALLERS_KEY));
     $this->assertTrue($this->manager->hasInstallerDescriptor('symlink'));
     $this->assertTrue($this->manager->hasInstallerDescriptor('cdn'));
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getExtraKey($key, $default = null)
 {
     return $this->rootPackageFile->getExtraKey($key, $default);
 }