private function implementation() { $this->checkMagentoConnectCredentials($this->output); $package = $this->config['magentoVersionData']; $this->config->setArray('magentoPackage', $package); if (file_exists($this->config->getString('installationFolder') . '/app/etc/env.php')) { throw new RuntimeException('A magento installation already exists in this folder'); } $args = new ProcessArguments(array($this->config['composer_bin'], 'create-project')); $args->addArgs($package['options'])->addArg($package['package'])->addArg($this->config->getString('installationFolder'))->addArg($package['version']); if (OutputInterface::VERBOSITY_VERBOSE <= $this->output->getVerbosity()) { $args->addArg('-vvv'); } /** * @TODO use composer helper */ $process = $args->createBuilder()->getProcess(); $process->setInput($this->input); if (OutputInterface::VERBOSITY_VERBOSE <= $this->output->getVerbosity()) { $this->output->writeln($process->getCommandLine()); } $process->setTimeout(86400); $process->start(); $code = $process->wait(function ($type, $buffer) { $this->output->write($buffer, false, OutputInterface::OUTPUT_RAW); }); if (Exec::CODE_CLEAN_EXIT !== $code) { throw new RuntimeException('Non-zero exit code for composer create-project command: ' . $process->getCommandLine()); } }
/** * @test */ public function chaining() { $actual = ProcessArguments::create()->addArg('command')->addArgs(array('-vvv', '--version-tricks-off', '--', '--' => true))->addArg('--')->addArgs(array('-vvv', '--file' => 'music', '--empty' => true, 'flag' => true))->createBuilder(); $this->assertInstanceOf(ProcessBuilder::class, $actual); $commandLine = $actual->getProcess()->getCommandLine(); $this->assertSame("'command' '-vvv' '--version-tricks-off' '--' '--' '--' '-vvv' '--file=music' '--empty' '--flag'", $commandLine); }