PullCommandTest::pullCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 9.536
c 0
b 0
f 0
cc 2
nc 2
nop 0
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 PullCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function pullCommand()
23
    {
24
        /* @var $pullCmd \Siad007\VersionControl\HG\Command\PullCommand */
25
        $pullCmd = Factory::getInstance('pull');
26
        $pullCmd->setSource('C:\\xampp\\source\\');
27
        $pullCmd->addRev('rev1');
28
        $pullCmd->addRev('rev2');
29
        $pullCmd->addBookmark('bookmark');
30
        $pullCmd->addBranch('branch');
31
        $pullCmd->setSsh('testSSH');
32
        $pullCmd->setInsecure(true);
33
        $pullCmd->setVerbose(true);
34
        $pullCmd->setEncoding('UTF-8');
35
36
        $source = '\'C:\xampp\source\\\'';
37
        $expected = 'hg pull --verbose --encoding ' . escapeshellarg('UTF-8') . ' --rev rev1 rev2 --bookmark bookmark --branch branch --ssh ' . escapeshellarg('testSSH') . ' --insecure ';
38
39
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
40
            $source = str_replace("'", '"', $source);
41
        }
42
43
        $this->assertSame($source, $pullCmd->getSource());
44
        $this->assertSame($expected . $source, $pullCmd->asString());
45
    }
46
}
47