Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
add / escape args for paths
Browse files Browse the repository at this point in the history
  • Loading branch information
scasei committed Jan 24, 2016
1 parent 4e01402 commit 887c1a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Tests/Processor/TarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ class TarTest extends \PHPUnit_Framework_TestCase
public function testGetCompressionCommand()
{
// build necessary data
$outputPath = ProcessUtils::escapeArgument('/var/backup/');
$archivePath = ProcessUtils::escapeArgument($outputPath . 'coucou.zip');
$outputPath = '/var/backup/';
$archivePath = $outputPath . 'coucou.zip';

// compress with default params
$processor = new TarProcessor(array());
$this->assertEquals(
$processor->getCompressionCommand($archivePath, $outputPath),
"tar c -C $outputPath . | gzip > $archivePath"
"tar c -C ". ProcessUtils::escapeArgument($outputPath)." . | gzip > ". ProcessUtils::escapeArgument($archivePath)
);

// compress with password - password not used in tar processor
$processor = new TarProcessor(array('password' => 'qwerty'));
$this->assertEquals(
$processor->getCompressionCommand($archivePath, $outputPath),
"tar c -C $outputPath . | gzip > $archivePath"
"tar c -C ". ProcessUtils::escapeArgument($outputPath)." . | gzip > ". ProcessUtils::escapeArgument($archivePath)
);

// compress with compression rate = 0
$processor = new TarProcessor(array('compression_ratio' => 0));
$this->assertEquals(
$processor->getCompressionCommand($archivePath, $outputPath),
"tar c -C $outputPath . | gzip -0 > $archivePath"
"tar c -C ". ProcessUtils::escapeArgument($outputPath)." . | gzip -0 > ". ProcessUtils::escapeArgument($archivePath)
);

// compress with compression rate = 9
$processor = new TarProcessor(array('compression_ratio' => 9));
$this->assertEquals(
$processor->getCompressionCommand($archivePath, $outputPath),
"tar c -C $outputPath . | gzip -9 > $archivePath"
"tar c -C ". ProcessUtils::escapeArgument($outputPath)." . | gzip -9 > ". ProcessUtils::escapeArgument($archivePath)
);
}
}

0 comments on commit 887c1a5

Please sign in to comment.