/** * {@inheritdoc} */ public function removePluginClasses(Expression $expr) { $save = false; $previousClasses = $this->rootPackageFile->getPluginClasses(); foreach ($previousClasses as $pluginClass) { if ($expr->evaluate($pluginClass)) { $this->rootPackageFile->removePluginClass($pluginClass); $save = true; } } if (!$save) { return; } try { $this->packageFileStorage->saveRootPackageFile($this->rootPackageFile); } catch (Exception $e) { $this->rootPackageFile->setPluginClasses($previousClasses); throw $e; } }
public function testRemovePluginClassDoesNothingIfNotFound() { $this->packageFile->addPluginClass(self::PLUGIN_CLASS); $this->packageFile->removePluginClass(self::OTHER_PLUGIN_CLASS); $this->assertSame(array(self::PLUGIN_CLASS), $this->packageFile->getPluginClasses()); }