/**
  * @param ComposerApplication $application
  * @param string              $namespace
  * @param InputInterface      $input
  * @param OutputInterface     $output
  *
  * @return int Exit code
  */
 private function executeInNamespace(ComposerApplication $application, $namespace, InputInterface $input, OutputInterface $output)
 {
     if (!file_exists($namespace)) {
         mkdir($namespace, 0777, true);
     }
     $this->chdir($namespace);
     return $application->doRun($input, $output);
 }
 public function ensureNoDevWarning($command)
 {
     $application = new Application();
     $application->add(new \Composer\Command\SelfUpdateCommand());
     $inputMock = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface');
     $outputMock = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $inputMock->expects($this->once())->method('getFirstArgument')->will($this->returnValue($command));
     $outputMock->expects($this->never())->method("writeln");
     if (!defined('COMPOSER_DEV_WARNING_TIME')) {
         define('COMPOSER_DEV_WARNING_TIME', time() - 1);
     }
     $this->setExpectedException('RuntimeException');
     $application->doRun($inputMock, $outputMock);
 }
Example #3
0
 public function ensureNoDevWarning($command)
 {
     $application = new Application();
     $application->add(new \Composer\Command\SelfUpdateCommand());
     $inputMock = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface');
     $outputMock = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $index = 0;
     $inputMock->expects($this->at($index++))->method('hasParameterOption')->with($this->equalTo('--no-plugins'))->will($this->returnValue(true));
     $inputMock->expects($this->at($index++))->method('getParameterOption')->with($this->equalTo(array('--working-dir', '-d')))->will($this->returnValue(false));
     $inputMock->expects($this->at($index++))->method('getFirstArgument')->will($this->returnValue('list'));
     $outputMock->expects($this->never())->method("writeln");
     if (!defined('COMPOSER_DEV_WARNING_TIME')) {
         define('COMPOSER_DEV_WARNING_TIME', time() - 1);
     }
     $application->doRun($inputMock, $outputMock);
 }
Example #4
0
<?php

require __DIR__ . '/../vendor/autoload.php';
use Composer\Console\Application;
use Nonlux\Composer\InstallPlugin;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
$app = new Application();
$app->doRun(new ArrayInput(['-d' => __DIR__]), new ConsoleOutput());
$plugin = new InstallPlugin();
$plugin->activate($app->getComposer(), $app->getIO());
$app->doRun(new ArrayInput(['install', '-d' => __DIR__]), new ConsoleOutput());