/** * @dataProvider dataProvider_Aguments */ public function testArguments($expectedAction, $expectedNumber, $args) { array_unshift($args, "svn-number.php"); // First argument is the script itself $svnNumber = new SvnNumber($args, $this->getBashCommandMock()); $this->assertSame($expectedAction, $svnNumber->getAction()); $this->assertSame($expectedNumber, $svnNumber->getRequestedNumbers()); }
$stagedFilePaths = $staging->getStagedFilePaths(); $status = new Status($svnNumber, $staging); $commitingFilePaths = array(); foreach ($status->getLines() as $line) { if (in_array($line->getFilePath(), $stagedFilePaths)) { $commitingFilePaths[] = escapeshellarg($line->getFilePath()); } } $svnNumber->exec(sprintf("svn commit %s %s", implode(" ", $commitingFilePaths), $svnNumber->getAdditionalArgsStr())); $staging->clear()->save(); $status = new Status($svnNumber, $staging); exit(printStatus($status, true)); case "stage": if ($svnNumber->hasRequestedNumbers()) { $status = new Status($svnNumber, $staging); $lines = array_intersect_key($status->getLines(), array_flip($svnNumber->getRequestedNumbers())); foreach ($lines as $line) { echo "Staged file: " . $line->getFilePath() . PHP_EOL; $staging->addLine($line); } $staging->save(); exit(printStatus($status, true)); } else { throw new \InvalidArgumentException("Command 'svn-number stage #' requires at least one number"); } break; case "stage-all": $status = new Status($svnNumber, $staging); $staging->clear(); foreach ($status->getLines() as $line) { echo "Staged file: " . $line->getFilePath() . PHP_EOL;