/** * @param GitWrapper $gitWrapper * @param GitCommand $gitCommand */ public function __construct(GitWrapper $gitWrapper, GitCommand $gitCommand) { $commandLine = ProcessUtils::escapeArgument($gitWrapper->getGitBinary()) . ' ' . $gitCommand->getCommandLine(); $directory = realpath($gitCommand->getDirectory()); $envVars = null; $wrapperEnvVars = $gitWrapper->getEnvVars(); if (!empty($wrapperEnvVars)) { $envVars = array_merge($_ENV, $_SERVER, $wrapperEnvVars); } parent::__construct($commandLine, $directory, $envVars, null, $gitCommand->getTimeout()); }
/** * @param array $options * @param array $arguments * @param $expected * * @dataProvider getCommandLineReturnsCommandDataProvider */ public function testGetCommandLineReturnsCommand(array $options, array $arguments, $expected) { $gitCommand = new GitCommand('test', $options, $arguments); $this->assertSame($expected, $gitCommand->getCommandLine()); }