public function whenIRunComposerWithThePlugin() { $factory = new Factory(); $this->io = new BufferIO(); $config = array_merge(array('config' => array('vendor-dir' => __DIR__ . '/__tmp/vendor'), 'repositories' => array('packagist' => false)), $this->json); $composer = $factory->createComposer($this->io, $config, true); $composer->setLocker(new Locker($this->io, new JsonFile('not-existing'), $composer->getRepositoryManager(), $composer->getInstallationManager(), '')); $this->executor = new TestProcessExecutorMock(); $composer->getDownloadManager()->setDownloader('git', new GitDownloader($this->io, $composer->getConfig(), $this->executor)); $cache = new Cache($this->io, __DIR__ . '/__tmp/vendor/cache'); $rfs = new TestRemoteFileSystemMock($this->remoteFiles); $composer->getDownloadManager()->setDownloader('file', new FileDownloader($this->io, $composer->getConfig(), $composer->getEventDispatcher(), $cache, $rfs)); $composer->getPluginManager()->addPlugin(new FidoPlugin(__DIR__ . '/__tmp')); $update = new UpdateCommand(); $update->setComposer($composer); $update->setIO($this->io); $update->run(new ArrayInput(array()), new BufferedOutput()); }
public function run($config_params = array()) { ob_start(); $input = new ArgvInput(array()); $output = new ConsoleOutput(); $helper = new HelperSet(); $config = new Config(); if (!empty($config_params)) { $config_composer = array('config' => $config_params); $config->merge($config_composer); } // $config_composer = array('config' => array( // 'prepend-autoloader' => false, // 'no-install' => true, // 'no-scripts' => true, // 'no-plugins' => true, // 'no-progress' => true, // 'no-dev' => true, // 'no-custom-installers' => true, // 'no-autoloader' => true // )); $output->setVerbosity(0); $io = new ConsoleIO($input, $output, $helper); $composer = Factory::create($io); $composer->setConfig($config); $update = new UpdateCommand(); $update->setComposer($composer); $out = $update->run($input, $output); ob_end_clean(); return $out; // $update = new InstallCommand(); // $update->setComposer($composer); // $out = $update->run($input, $output); // dd($output); // $input = new ArrayInput(array('command' => 'update')); // ////Create the application and run it with the commands // $application = new Application(); // $application->setAutoExit(false); // $out = $application->run($input); // dd($out); // echo "Done."; }