public function testComplexCommand() { $command = new Command(); $command->binary('binary')->argument('argument1')->argument('argument2')->option('n', 'n')->option('long', 'option')->file('file'); $expected = 'binary argument1 argument2 -n n --long option "file"'; $this->assertEquals($expected, (string) $command); }
/** * Clones a git repository. * * @param string $uri the git url * @param string $folder the folder to clone to, if not set defaults to repository name * @param string $branch the branch to checkout, defaults to "main" branch (as set in repository config) * * @return boolean true on success */ public function cloneRepository($uri, $folder = null, $branch = null) { $command = new Command(); $command->binary('git')->argument('clone')->argument($uri); if (null !== $folder) { $command->argument($folder); } if (null !== $branch) { $command->option('branch', $branch); } return 0 === $this->execute($command); }