Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $watch = $input->getOption('watch');
     $buffered = new BufferedOutput($output->getVerbosity(), $output->isDecorated());
     $service = new StatsService($this->getBeanstalk());
     do {
         $tubes = $service->getAllTubeStats();
         if (empty($tubes)) {
             $output->writeln('No tubes found.');
             return;
         }
         $table = new Table($buffered);
         $table->setHeaders($service->getTubeHeaderMapping());
         foreach ($tubes as $stats) {
             if ($stats['current-jobs-buried'] > 0) {
                 $stats['name'] = "<error>{$stats['name']}</error>";
                 $stats['current-jobs-buried'] = "<error>{$stats['current-jobs-buried']}</error>";
             }
             $table->addRow($stats);
         }
         $table->render();
         $clearScreen = $watch ? "" : '';
         $output->write($clearScreen . $buffered->fetch());
         $watch && sleep(1);
     } while ($watch);
 }
Example #2
0
 /**
  * @return Response
  * @Route("/swagger.yml", name="swagger", methods="GET")
  */
 public function dump() : Response
 {
     $output = new BufferedOutput();
     $event = new ConsoleEvent('swagger:dump', $output);
     $this->dispatchEvent($event);
     return new Response($output->fetch(), 200, ['Content-Type' => 'text/x-yaml']);
 }
 public function testQuietLogDebug()
 {
     $bufferedOutput = new BufferedOutput(OutputInterface::VERBOSITY_VERY_VERBOSE);
     $installOutput = new InstallOutput(new ConsoleLogger($bufferedOutput));
     $installOutput->debug('Testing log');
     $this->assertEmpty($bufferedOutput->fetch());
 }
 public function testLogsFromListeners()
 {
     $output = new BufferedOutput();
     $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
     $handler = new ConsoleHandler(null, false);
     $logger = new Logger('app');
     $logger->pushHandler($handler);
     $dispatcher = new EventDispatcher();
     $dispatcher->addListener(ConsoleEvents::COMMAND, function () use($logger) {
         $logger->addInfo('Before command message.');
     });
     $dispatcher->addListener(ConsoleEvents::TERMINATE, function () use($logger) {
         $logger->addInfo('Before terminate message.');
     });
     $dispatcher->addSubscriber($handler);
     $dispatcher->addListener(ConsoleEvents::COMMAND, function () use($logger) {
         $logger->addInfo('After command message.');
     });
     $dispatcher->addListener(ConsoleEvents::TERMINATE, function () use($logger) {
         $logger->addInfo('After terminate message.');
     });
     $event = new ConsoleCommandEvent(new Command('foo'), $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface'), $output);
     $dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
     $this->assertContains('Before command message.', $out = $output->fetch());
     $this->assertContains('After command message.', $out);
     $event = new ConsoleTerminateEvent(new Command('foo'), $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface'), $output, 0);
     $dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
     $this->assertContains('Before terminate message.', $out = $output->fetch());
     $this->assertContains('After terminate message.', $out);
 }
Example #5
0
 public function testShouldNotClearScreenInNotInteractiveMode()
 {
     $SUT = $this->createSUT();
     $this->input->setInteractive(false);
     $SUT->cls();
     $this->assertEquals('', $this->output->fetch());
 }
 public function postInstall(Request $request, Installer $installer, Dispatcher $dispatcher)
 {
     $output = new BufferedOutput();
     $installer->setFieldValues($request->all());
     $versions = $installer->getVersions();
     foreach ($versions as $version) {
         $tasks = $installer->getTasksForVersion($version);
         foreach ($tasks as $task) {
             $output->writeln('<span class="text-info">Running ' . $task->getTitle() . ' Task...</span>');
             try {
                 $task->setInput($installer->getFieldValues());
                 $task->run($output);
             } catch (TaskRunException $e) {
                 $output->writeln('<span class="text-danger">' . $e->getMessage() . '</span>');
                 return new JsonResponse(['output' => $output, 'status' => 'error'], 200);
             }
             $output->writeln('<span class="text-info">Task ' . $task->getTitle() . ' Completed!</span>');
         }
     }
     $dispatcher->fire(new AfterInstallEvent($installer, $output));
     $installer->saveCompleted();
     $output->writeln('<span class="text-success">Installation Completed!</span>');
     $output = array_filter(explode("\n", $output->fetch()));
     return new JsonResponse(['output' => $output, 'status' => 'success'], 200);
 }
Example #7
0
 /**
  * @param array $rows
  */
 private function printBody(array $rows)
 {
     if (!count($rows)) {
         $this->output->writeln('<info>No violations.</info>');
         return;
     }
     $this->printRows($rows);
 }
Example #8
0
 /**
  * @dataProvider provideOutputMappingParams
  */
 public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = array())
 {
     $out = new BufferedOutput($outputVerbosity);
     $logger = new ConsoleLogger($out, $addVerbosityLevelMap);
     $logger->log($logLevel, 'foo bar');
     $logs = $out->fetch();
     $this->assertEquals($isOutput ? "[{$logLevel}] foo bar\n" : '', $logs);
 }
 public function testAllowFailingCommand()
 {
     $output = new BufferedOutput();
     $executor = new ProcessExecutor($output, 60);
     $expectedOutput = "ls: cannot access '/no-such-file': No such file or directory\n";
     $exitCode = $executor->execute('LC_ALL=C ls /no-such-file', null, true);
     $this->assertEquals(2, $exitCode);
     $this->assertEquals($expectedOutput, $output->fetch());
 }
 /**
  * Test that the execution is successful.
  *
  * @return void
  */
 public function testExecution()
 {
     $project = $this->getMockBuilder('CyberSpectrum\\PharPiler\\Project')->disableOriginalConstructor()->getMock();
     $task = new RunCommandTask(['command' => 'echo "hello world"', 'working_dir' => getcwd(), 'timeout' => null]);
     $task->setLogger(new ConsoleLogger($output = new BufferedOutput()));
     $output->setVerbosity(BufferedOutput::VERBOSITY_DEBUG);
     $task->execute($project);
     $this->assertEquals('[info] echo "hello world": hello world' . "\n" . '[info] echo "hello world": ' . "\n", $output->fetch());
 }
 function testRunCommand()
 {
     $inputData = ['command' => 'update', MagentoComposerApplication::COMPOSER_WORKING_DIR => '.'];
     $this->composerApplication->expects($this->once())->method('resetComposer');
     $this->inputFactory->expects($this->once())->method('create')->with($inputData);
     $this->consoleOutput->expects($this->once())->method('fetch')->willReturn('Nothing to update');
     $this->composerApplication->expects($this->once())->method('run')->willReturn(0);
     $message = $this->application->runComposerCommand($inputData);
     $this->assertEquals('Nothing to update', $message);
 }
Example #12
0
 /**
  * @param array $args
  * @return string output
  */
 protected function runCommand(array $args)
 {
     $app = new Application(static::$kernel);
     $app->setAutoExit(false);
     // run application prepending application name
     $code = $app->run(new ArgvInput(array_merge(['cli.php'], $args)), $out = new BufferedOutput());
     $output = $out->fetch();
     $this->assertEquals(0, $code, sprintf('The command "%s" was failed. (code: %d) %s', implode(' ', $args), $code, $output));
     return $output;
 }
Example #13
0
 public function testEmit()
 {
     $output = new BufferedOutput();
     $emitter = new ConsoleEmitter($output);
     $response = new TextResponse('The Test');
     $emitter->emit($response);
     $result = $output->fetch();
     $this->assertContains('200', $result);
     $this->assertContains('text/plain', $result);
     $this->assertContains('The Test', $result);
 }
 public function helpAction()
 {
     $model = $this->getModel();
     $requestCommand = $this->getRequest()->get('command');
     $cli = $this->getCliApplication();
     $command = $cli->get($requestCommand);
     $model['definition'] = $command->getDefinition();
     $input = new ArrayInput(array(sprintf("help %s", $requestCommand)));
     $output = new BufferedOutput();
     // $cli->run($input, $output);
     $model['output'] = $output->fetch();
     return $this->render('SKITCBundle:Console:help.html.twig', $model);
 }
Example #15
0
 public function testRightColumnsHeadersNamesAfterItemConverter()
 {
     $data = array(array('first' => 'John', 'lastname' => 'Doe'), array('first' => 'Ivan', 'lastname' => 'Sidorov'));
     $reader = new ArrayReader($data);
     $converter = new MappingItemConverter();
     $converter->addMapping('first', 'firstname');
     $output = new BufferedOutput();
     $table = new Table($output);
     $table->setStyle('compact');
     $workflow = new Workflow($reader);
     $workflow->addItemConverter($converter)->addWriter(new ConsoleTableWriter($output, $table))->process();
     $this->assertRegExp('/\\s+lastname\\s+firstname\\s+Doe\\s+John\\s+Sidorov\\s+Ivan\\s+/', $output->fetch());
 }
Example #16
0
 /**
  * @param JobStats[]|ArrayCollection $statsList
  * @return string
  */
 private function renderStats($statsList)
 {
     $buffer = new BufferedOutput();
     $buffer->setDecorated(true);
     $width = $this->getConsoleWidth();
     $table = $width ? new AutoHidingTable($buffer, $width) : new Table($buffer);
     $table->setHeaders(array('ID', 'Tube', 'State', '# Reserves', '# Releases', '# Buries', '# Kicks', 'Priority', 'Time left (secs)', '# Timeouts', 'Age (secs)', 'File'));
     foreach ($statsList as $stats) {
         $table->addRow(array($stats->id(), $stats->tube(), $stats->state(), $stats->reserves(), $stats->releases(), $stats->buries(), $stats->kicks(), $stats->priority(), in_array($stats->state(), array('reserved', 'delayed')) ? $stats->timeLeft() : 'N/A', $stats->timeouts(), $stats->age(), $stats->file() === 0 ? 'N/A' : $stats->file()));
     }
     $table->render();
     return $buffer->fetch();
 }
 /**
  * @medium
  */
 public function testPlaintextReportIsCorrectlyGenerated()
 {
     $file1 = new File('foobar.tys');
     $file1->addWarning(new Warning(123, 12, 'Message #1', Warning::SEVERITY_INFO, 'foobar'));
     $file1->addWarning(new Warning(124, NULL, 'Message #2', Warning::SEVERITY_WARNING, 'foobar'));
     $file2 = new File('bar.txt');
     $file2->addWarning(new Warning(412, 141, 'Message #3', Warning::SEVERITY_ERROR, 'barbaz'));
     $report = new Report();
     $report->addFile($file1);
     $report->addFile($file2);
     $this->printer->writeReport($report);
     $this->assertEquals(self::EXPECTED_XML_DOCUMENT, $this->output->fetch());
 }
Example #18
0
 /**
  * @param WorkerInfo[]|ArrayCollection $workers
  * @return string
  */
 protected function renderStats($workers)
 {
     $buffer = new BufferedOutput();
     $buffer->setDecorated(true);
     $width = $this->getConsoleWidth();
     $table = $width ? new AutoHidingTable($buffer, $width) : new Table($buffer);
     $table->setHeaders(array('Worker', 'Running', 'Total', 'PIDs'));
     foreach ($workers as $worker) {
         $table->addRow(array($worker->getName(), $worker->getNumRunning(), $worker->getTotal(), $worker->getPids()->join(', ')));
     }
     $table->render();
     return $buffer->fetch();
 }
 /**
  * @inheritdoc
  */
 function format($result)
 {
     $out = new BufferedOutput();
     $table = new Table($out);
     $rows = array();
     $headers = array('Function description', 'Execution time (s)', 'Memory usage (mb)', 'Times faster');
     foreach ($result->getResults() as $result) {
         $rows[] = array($result->getDescription(), $result->getTime(), $result->getMemUsage(), $result->getTimesFaster());
     }
     $table->setHeaders($headers);
     $table->setRows($rows);
     $table->render();
     return $out->fetch();
 }
 /**
  * Test that a wide table is adapted to a maximum width.
  */
 public function testAdaptedRowsFitMaxTableWidth()
 {
     $maxTableWidth = 60;
     $buffer = new BufferedOutput();
     $table = new AdaptiveTable($buffer, $maxTableWidth);
     $table->setHeaders([['Row', 'Lorem', 'ipsum', 'dolor', 'sit']]);
     $table->setRows([['#1', 'amet', 'consectetur', 'adipiscing elit', 'Quisque pulvinar'], ['#2', 'tellus sit amet', 'sollicitudin', 'tincidunt', 'risus'], ['#3', 'risus', 'sem', 'mattis', 'ex'], ['#4', 'quis', 'luctus metus', 'lorem cursus', 'ligula']]);
     $table->render();
     // Test that the table fits into the maximum width.
     $lineWidths = [];
     foreach (explode(PHP_EOL, $buffer->fetch()) as $line) {
         $lineWidths[] = strlen($line);
     }
     $this->assertLessThanOrEqual($maxTableWidth, max($lineWidths));
 }
Example #21
0
 /**
  * This method is executed after initialize(). It usually contains the logic
  * to execute to complete this command task.
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $maxResults = $input->getOption('max-results');
     // Use ->findBy() instead of ->findAll() to allow result sorting and limiting
     $users = $this->em->getRepository('AppBundle:User')->findBy(array(), array('id' => 'DESC'), $maxResults);
     // Doctrine query returns an array of objects and we need an array of plain arrays
     $usersAsPlainArrays = array_map(function ($user) {
         return array($user->getId(), $user->getUsername(), $user->getEmail(), implode(', ', $user->getRoles()));
     }, $users);
     // In your console commands you should always use the regular output type,
     // which outputs contents directly in the console window. However, this
     // particular command uses the BufferedOutput type instead.
     // The reason is that the table displaying the list of users can be sent
     // via email if the '--send-to' option is provided. Instead of complicating
     // things, the BufferedOutput allows to get the command output and store
     // it in a variable before displaying it.
     $bufferedOutput = new BufferedOutput();
     $table = new Table($bufferedOutput);
     $table->setHeaders(array('ID', 'Username', 'Email', 'Roles'))->setRows($usersAsPlainArrays);
     $table->render();
     // instead of displaying the table of users, store it in a variable
     $tableContents = $bufferedOutput->fetch();
     if (null !== ($email = $input->getOption('send-to'))) {
         $this->sendReport($tableContents, $email);
     }
     $output->writeln($tableContents);
 }
Example #22
0
 /**
  * @param TubeStats[]|ArrayCollection $stats
  * @param int|null                    $width
  * @return string
  */
 private function renderStats(ArrayCollection $stats, $width = null)
 {
     if ($stats->isEmpty()) {
         return 'There are no current tubes';
     }
     $buffer = new BufferedOutput();
     $buffer->setDecorated(true);
     $width = $width ?: $this->getConsoleWidth();
     $table = $width ? new AutoHidingTable($buffer, $width) : new Table($buffer);
     $table->setHeaders(array('Tube', 'Ready', 'Buried', 'Reserved', 'Delayed', 'Urgent', 'Total', '', 'Using', 'Watching', 'Waiting', '', 'Pause Elapsed', 'Pause Left', '', 'Delete Count', 'Pause Count'));
     foreach ($stats as $tubeStats) {
         $table->addRow(array($tubeStats->name(), $tubeStats->readyJobs(), $tubeStats->buriedJobs(), $tubeStats->reservedJobs(), $tubeStats->delayedJobs(), $tubeStats->urgentJobs(), $tubeStats->totalJobs(), '', $tubeStats->usingCount(), $tubeStats->watchingCount(), $tubeStats->waitingCount(), '', $tubeStats->pause(), $tubeStats->pauseTimeLeft(), '', $tubeStats->cmdDeleteCount(), $tubeStats->cmdPauseTubeCount()));
     }
     $table->render();
     return $buffer->fetch();
 }
Example #23
0
 /**
  * Test if overriding a parameter works.
  *
  * @param string $script        The script to run.
  *
  * @param string $definition    The argument to pass.
  *
  * @param string $expectedValue The expected output value.
  *
  * @return bool
  */
 private function testOverride($script, $definition, $expectedValue)
 {
     $output = $this->testCliRuntime($script, $definition);
     if ($expectedValue !== $output) {
         $this->log->writeln('Could not override via ' . $definition);
         return false;
     }
     return true;
 }
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     $request = $event->getRequest();
     if ($this->isRequestAcceptsJson($request)) {
         $exception = $event->getException();
         $response = new JsonResponse(['message' => $exception->getMessage(), 'trace' => $exception->getTrace(), 'code' => $exception->getCode()]);
         $event->setResponse($response);
     }
     if ($this->isRequestFromTests($request)) {
         $exception = $event->getException();
         $output = new BufferedOutput(OutputInterface::VERBOSITY_VERBOSE, true);
         $output->writeln($exception->getMessage());
         $output->writeln($exception->getCode());
         $output->writeln($exception->getTraceAsString());
         $response = new Response($output->fetch());
         $event->setResponse($response);
     }
 }
Example #25
0
 /**
  * @inheritdoc
  */
 public function terminate(ResultCollection $collection, ResultCollection $groupedResults)
 {
     $output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true);
     //        $output->write(str_pad("\x0D", 80, "\x20"));
     //        $output->writeln('');
     // overview
     $total = $this->bound->calculate($collection);
     $output->writeln(sprintf('<info>%d</info> files have been analyzed. Read and understand these <info>%s</info> lines of code will take around <info>%s</info>.', sizeof($collection, COUNT_NORMAL), $total->getSum('loc'), $this->formatTime($total->getSum('time'))));
     $output->writeln('<info>Average for each module:</info>');
     $output->writeln('');
     $hasOOP = null !== $total->getSum('instability');
     $table = new TableHelper();
     $table->setHeaders(array_merge(array('Name', 'Complexity', 'Myer Distance', 'Maintainability', 'LLOC', 'Comment weight', 'Vocabulary', 'Volume', 'Bugs', 'Difficulty'), $hasOOP ? array('lcom', 'SysComplexity', 'Instability', 'Abstractness', 'ce', 'ca') : array()))->setLayout(TableHelper::LAYOUT_DEFAULT);
     foreach ($groupedResults as $result) {
         $table->addRow(array_merge(array(str_repeat('  ', $result->getDepth()) . $result->getName(), $this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0), $this->getRow($result->getBounds(), 'myerDistance', 'average', 0), $this->getRow($result->getBounds(), 'maintainabilityIndex', 'average', 0), $this->getRow($result->getBounds(), 'logicalLoc', 'sum', 0), $this->getRow($result->getBounds(), 'commentWeight', 'average', 0), $this->getRow($result->getBounds(), 'vocabulary', 'average', 0), $this->getRow($result->getBounds(), 'volume', 'average', 0), $this->getRow($result->getBounds(), 'bugs', 'sum', 2), $this->getRow($result->getBounds(), 'difficulty', 'average', 0)), $hasOOP ? array($this->getRow($result->getBounds(), 'lcom', 'average', 2), $this->getRow($result->getBounds(), 'rsysc', 'average', 2), $result->getInstability()->getInstability(), $result->getAbstractness()->getAbstractness(), $this->getRow($result->getBounds(), 'efferentCoupling', 'average', 2), $this->getRow($result->getBounds(), 'afferentCoupling', 'average', 2)) : array()));
     }
     $table->render($output);
     return $output->fetch();
 }
Example #26
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * Execute occ command
  * Sample request
  *	POST http://domain.tld/index.php/occ/status',
  * 		{
  *			'params': {
  * 					'--no-warnings':'1',
  *		 			'--output':'json'
  * 			},
  * 			'token': 'someToken'
  * 		}
  *
  * @param string $command
  * @param string $token
  * @param array $params
  *
  * @return JSONResponse
  * @throws \Exception
  */
 public function execute($command, $token, $params = [])
 {
     try {
         $this->validateRequest($command, $token);
         $output = new BufferedOutput();
         $formatter = $output->getFormatter();
         $formatter->setDecorated(false);
         $this->console->setAutoExit(false);
         $this->console->loadCommands(new ArrayInput([]), $output);
         $inputArray = array_merge(['command' => $command], $params);
         $input = new ArrayInput($inputArray);
         $exitCode = $this->console->run($input, $output);
         $response = $output->fetch();
         $json = ['exitCode' => $exitCode, 'response' => $response];
     } catch (\UnexpectedValueException $e) {
         $json = ['exitCode' => 126, 'response' => 'Not allowed', 'details' => $e->getMessage()];
     }
     return new JSONResponse($json);
 }
Example #27
0
 /**
  * @dataProvider inputProvider
  * @param string $stringInput
  * @param string $expectedIdeKey
  */
 public function testShouldGetIdeKeyFromCommandOptionOnCommandInitialization($stringInput, $expectedIdeKey)
 {
     $this->mockXdebugExtension($isExtensionLoaded = true, $isRemoteEnabled = true);
     $command = new RunCommand(new EventDispatcher());
     $input = new StringInput($stringInput);
     $output = new BufferedOutput();
     $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
     // Trigger event to add the xdebug option to the command and bind the definition to the input
     $this->listener->onCommandConfigure(new BasicConsoleEvent($command));
     $input->bind($command->getDefinition());
     // Trigger command initialization event
     $event = new ExtendedConsoleEvent($command, $input, $output);
     $this->listener->onCommandRunTestsInit($event);
     if ($expectedIdeKey !== null) {
         $this->assertContains('Xdebug remote debugging initialized with IDE key: ' . $expectedIdeKey, $output->fetch());
     } else {
         // no output expected (xdebug not triggered)
         $this->assertEmpty($output->fetch());
     }
 }
 /**
  * @param string|array $php
  * @param string|array $zephirExpected
  */
 public function assertConvertToZephir($php, $zephir)
 {
     if (is_array($php) === false) {
         $php = array($php);
     }
     $bufferOutput = new BufferedOutput();
     $logger = new Logger($bufferOutput, false, false);
     $generated = array_values($this->getEngine()->convert(new StringCodeCollector($php), $logger));
     $this->assertCount(count($zephir), $generated, $bufferOutput->fetch());
     self::delTree('Code');
     foreach ($generated as $index => $file) {
         $zephirGenerated = $this->getRender()->render($file);
         if (is_array($zephir) === true) {
             $this->assertEquals($this->showWiteSpace($zephir[$index]), $this->showWiteSpace($zephirGenerated));
         } else {
             $this->assertEquals($this->showWiteSpace($zephir), $this->showWiteSpace($zephirGenerated));
         }
     }
     if (count($zephir) !== 0) {
         $this->assertTrue($this->getCodeValidator()->isValid('Code'));
     }
 }
Example #29
0
 public function testDumpDataWithFullConfiguration()
 {
     $outputBuffer = new BufferedOutput();
     $dumper = new Dumper($outputBuffer);
     $pdoMock = $this->getMock('\\stdClass', array('setAttribute'));
     $this->dbMock->expects($this->any())->method('getWrappedConnection')->willReturn($pdoMock);
     $this->dbMock->expects($this->any())->method('fetchColumn')->willReturn(2);
     $this->dbMock->expects($this->any())->method('fetchAll')->willReturnCallback(function ($query) {
         if (strpos($query, 'SHOW COLUMNS') !== false) {
             return array(array('Field' => 'col1', 'Type' => 'varchar'), array('Field' => 'col2', 'Type' => 'blob'));
         }
         throw new \RuntimeException('Unexpected fetchAll-call: ' . $query);
     });
     $this->dbMock->expects($this->any())->method('quote')->willReturnCallback(function ($value) {
         return $value;
     });
     $this->dbMock->expects($this->any())->method('query')->willReturn(array(array('col1' => 'value1.1', 'col2' => 'value1.2'), array('col1' => 'value2.1', 'col2' => 'value2.2')));
     $table = new Table(new \SimpleXMLElement('<table name="test" dump="full" />'));
     $dumper->dumpData('test', $table, $this->dbMock);
     $output = $outputBuffer->fetch();
     $this->assertContains('INSERT INTO', $output);
 }
 /**
  * Run composer command
  *
  * @param array $commandParams
  * @return bool
  * @throws \RuntimeException
  */
 protected function runComposerCommand(array $commandParams)
 {
     $input = $this->consoleArrayInputFactory->create($commandParams);
     $this->consoleApplication->setAutoExit(false);
     putenv('COMPOSER_HOME=' . $this->composerConfigFileDir . '/' . self::COMPOSER_HOME_DIR);
     putenv('COMPOSER=' . $this->composerConfigFileDir . '/composer.json');
     $exitCode = $this->consoleApplication->run($input, $this->consoleOutput);
     $output = $this->consoleOutput->fetch();
     if ($exitCode) {
         $commandParamsString = json_encode($commandParams, JSON_UNESCAPED_SLASHES);
         throw new \RuntimeException(sprintf('Command "%s"%s failed: %s', $commandParams['command'], $commandParamsString, $output));
     }
     return $output;
 }