1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* VersionControl_HG |
4
|
|
|
* Simple OO implementation for Mercurial. |
5
|
|
|
* |
6
|
|
|
* PHP Version 5.4 |
7
|
|
|
* |
8
|
|
|
* @copyright 2014 Siad Ardroumli |
9
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT |
10
|
|
|
* @link http://siad007.github.io/versioncontrol_hg |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Siad007\VersionControl\HG\Tests\Command; |
14
|
|
|
|
15
|
|
|
use Siad007\VersionControl\HG\Factory; |
16
|
|
|
|
17
|
|
|
class BundleCommandTest extends \PHPUnit_Framework_TestCase |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @test |
21
|
|
|
*/ |
22
|
|
|
public function bundleCommand() |
23
|
|
|
{ |
24
|
|
|
$bundleCmd = Factory::createBundle(); |
25
|
|
|
$bundleCmd->setFile('C:\\xampp\\file\\'); |
26
|
|
|
$bundleCmd->setDestination('C:\\xampp\\dest\\'); |
27
|
|
|
$bundleCmd->setSsh('testSSH'); |
28
|
|
|
$bundleCmd->setInsecure(true); |
29
|
|
|
$bundleCmd->setVerbose(true); |
30
|
|
|
$bundleCmd->setEncoding('UTF-8'); |
31
|
|
|
|
32
|
|
|
$destination = '\'C:\xampp\dest\\\''; |
33
|
|
|
$file = '\'C:\xampp\file\\\''; |
34
|
|
|
$expected = 'hg bundle --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure '; |
35
|
|
|
|
36
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
37
|
|
|
$destination = str_replace("'", '"', $destination); |
38
|
|
|
$file = str_replace("'", '"', $file); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$this->assertSame($destination, $bundleCmd->getDestination()); |
42
|
|
|
$this->assertSame($file, $bundleCmd->getFile()); |
43
|
|
|
$this->assertSame($expected . $file . ' ' . $destination, $bundleCmd->asString()); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|