Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 committed Jun 16, 2015
1 parent 1db73ae commit 68c8327
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function assembleOptionString()
} elseif (is_string($option) && $option !== '') {
$optionString .= " {$name} " . escapeshellarg($option);
} elseif (is_array($option) && !empty($option)) {
$optionString .= " {$name} " . implode(' ', escapeshellarg($option));
$optionString .= " {$name} " . implode(' ', $option);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Command/AddremoveCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function addremoveCommand()
$addremoveCmd->setDryRun(true);

$file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
$expected = 'hg addremove --similarity 50 --include includePattern --exclude excludePattern --dry-run ';
$expected = 'hg addremove --similarity ' . escapeshellarg('50') . ' --include includePattern --exclude excludePattern --dry-run ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$file = str_replace("'", '"', $file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BackoutCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function backoutCommand()
$backoutCmd->setUser('user');

$revision = '\'revision\'';
$expected = 'hg backout --merge --tool tool --include includePattern --exclude excludePattern --message text --logfile logfile --date date --user user ';
$expected = 'hg backout --merge --tool ' . escapeshellarg('tool') . ' --include includePattern --exclude excludePattern --message ' . escapeshellarg('text') . ' --logfile ' . escapeshellarg('logfile') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$revision = str_replace("'", '"', $revision);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BookmarksCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function bookmarksCommand()
$bookmarksCmd->setRename('name');

$name = '\'test1\' \'test2\'';
$expected = 'hg bookmarks --force --rev revision --rename name ';
$expected = 'hg bookmarks --force --rev ' . escapeshellarg('revision') . ' --rename ' . escapeshellarg('name') . ' ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$name = str_replace("'", '"', $name);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BundleCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function bundleCommand()

$destination = '\'C:\xampp\dest\\\'';
$file = '\'C:\xampp\file\\\'';
$expected = 'hg bundle --verbose --encoding UTF-8 --ssh testSSH --insecure ';
$expected = 'hg bundle --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$destination = str_replace("'", '"', $destination);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/CatCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function catCommand()
$catCmd->setDecode(true);

$file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
$expected = 'hg cat --output output --rev revision --decode --include includePattern --exclude excludePattern ';
$expected = 'hg cat --output ' . escapeshellarg('output') . ' --rev ' . escapeshellarg('revision') . ' --decode --include includePattern --exclude excludePattern ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$file = str_replace("'", '"', $file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/CommitCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function commitCommand()
$commitCmd->setSubrepos(true);

$file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
$expected = 'hg commit --addremove --close-branch --amend --secret --edit --include includePattern --exclude excludePattern --message text --logfile logfile --date date --user user --subrepos ';
$expected = 'hg commit --addremove --close-branch --amend --secret --edit --include includePattern --exclude excludePattern --message ' . escapeshellarg('text') . ' --logfile ' . escapeshellarg('logfile') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' --subrepos ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$file = str_replace("'", '"', $file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/HeadsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function headsCommand()
$headsCmd->setRev('startrev');
$headsCmd->setTopo(true);

$expected = 'hg heads --rev startrev --topo --closed --template template';
$expected = 'hg heads --rev ' . escapeshellarg('startrev') . ' --topo --closed --template ' . escapeshellarg('template');

$this->assertSame($expected, $headsCmd->asString());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ImportCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function importCommand()
$importCmd->setSimilarity('similarity');

$patch = '\'patch1\' \'patch2\'';
$expected = 'hg import --strip num --edit --no-commit --bypass --exact --import-branch --message text --logfile logfile --date date --user user --similarity similarity ';
$expected = 'hg import --strip ' . escapeshellarg('num') . ' --edit --no-commit --bypass --exact --import-branch --message ' . escapeshellarg('text') . ' --logfile ' . escapeshellarg('logfile') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' --similarity ' . escapeshellarg('similarity') . ' ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$patch = str_replace("'", '"', $patch);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/InitCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function initCommand()
$initCmd->setEncoding('UTF-8');

$destination = '\'C:\xampp\dest\\\'';
$expected = 'hg init --verbose --encoding UTF-8 --ssh testSSH --insecure ';
$expected = 'hg init --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$destination = str_replace("'", '"', $destination);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ManifestCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function manifestCommand()
$manifestCmd->setRev('test');
$manifestCmd->setAll(true);

$expected = 'hg manifest --rev test --all';
$expected = 'hg manifest --rev ' . escapeshellarg('test') . ' --all';

$this->assertSame($expected, $manifestCmd->asString());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/MergeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function mergeCommand()
$mergeCmd->setTool('testtool');
$mergeCmd->setPreview(true);

$expected = 'hg merge --rev revision --preview --tool testtool';
$expected = 'hg merge --rev ' . escapeshellarg('revision') . ' --preview --tool ' . escapeshellarg('testtool');

$this->assertSame($expected, $mergeCmd->asString());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ParentsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function parentsCommand()
$parentsCmd->setTemplate('template');

$file = '\'C:\xampp\file\\\'';
$expected = 'hg parents --rev revision --template template ';
$expected = 'hg parents --rev ' . escapeshellarg('revision') . ' --template ' . escapeshellarg('template') . ' ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$file = str_replace("'", '"', $file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/PhaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function phaseCommand()
$phaseCmd->setVerbose(true);
$phaseCmd->setEncoding('UTF-8');

$expected = 'hg phase --verbose --encoding UTF-8 --public --force';
$expected = 'hg phase --verbose --encoding ' . escapeshellarg('UTF-8') . ' --public --force';

$this->assertSame($expected, $phaseCmd->asString());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/PullCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function pullCommand()
$pullCmd->setEncoding('UTF-8');

$source = '\'C:\xampp\source\\\'';
$expected = 'hg pull --verbose --encoding UTF-8 --rev rev1 rev2 --bookmark bookmark --branch branch --ssh testSSH --insecure ';
$expected = 'hg pull --verbose --encoding ' . escapeshellarg('UTF-8') . ' --rev rev1 rev2 --bookmark bookmark --branch branch --ssh ' . escapeshellarg('testSSH') . ' --insecure ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$source = str_replace("'", '"', $source);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/PushCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function pushCommand()
$pushCmd->setEncoding('UTF-8');

$destination = '\'C:\xampp\dest\\\'';
$expected = 'hg push --verbose --encoding UTF-8 --ssh testSSH --insecure ';
$expected = 'hg push --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$destination = str_replace("'", '"', $destination);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ResolveCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function resolveCommand()
$resolveCmd->setNoStatus(true);

$file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
$expected = 'hg resolve --all --list --mark --unmark --no-status --tool testtool --include includePattern --exclude excludePattern ';
$expected = 'hg resolve --all --list --mark --unmark --no-status --tool ' . escapeshellarg('testtool') . ' --include includePattern --exclude excludePattern ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$file = str_replace("'", '"', $file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/RevertCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function revertCommand()
$revertCmd->setDryRun(true);

$name = '\'name1\' \'name2\'';
$expected = 'hg revert --all --date date --rev revision --no-backup --include includePattern --exclude excludePattern --dry-run ';
$expected = 'hg revert --all --date ' . escapeshellarg('date') . ' --rev ' . escapeshellarg('revision') . ' --no-backup --include includePattern --exclude excludePattern --dry-run ';

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$name = str_replace("'", '"', $name);
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/TagCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function tagCommand()
$tagCmd->setUser('user');

$name = 'rev rev2';
$expected = 'hg tag --force --local --rev test --remove --edit --message text --date date --user user ';
$expected = 'hg tag --force --local --rev ' . escapeshellarg('test') . ' --remove --edit --message ' . escapeshellarg('text') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' ';

$this->assertSame($name, implode(' ', $tagCmd->getName()));
$this->assertSame($expected . $name, $tagCmd->asString());
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/UpdateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function updateCommand()
$updateCmd->setDate('date');
$updateCmd->setRev('rev');

$expected = 'hg update --clean --check --date date --rev rev';
$expected = 'hg update --clean --check --date ' . escapeshellarg('date') . ' --rev ' . escapeshellarg('rev');

$this->assertSame($expected, $updateCmd->asString());
}
Expand Down

0 comments on commit 68c8327

Please sign in to comment.