PushCommandTest::pushCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.6
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 PushCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function pushCommand()
23
    {
24
        /* @var $pushCmd \Siad007\VersionControl\HG\Command\PushCommand */
25
        $pushCmd = Factory::getInstance('push');
26
        $pushCmd->setDestination('C:\\xampp\\dest\\');
27
        $pushCmd->setSsh('testSSH');
28
        $pushCmd->setInsecure(true);
29
        $pushCmd->setVerbose(true);
30
        $pushCmd->setEncoding('UTF-8');
31
32
        $destination = '\'C:\xampp\dest\\\'';
33
        $expected = 'hg push --verbose --encoding ' . escapeshellarg('UTF-8') . ' --ssh ' . escapeshellarg('testSSH') . ' --insecure ';
34
35
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
36
            $destination = str_replace("'", '"', $destination);
37
        }
38
39
        $this->assertSame($destination, $pushCmd->getDestination());
40
        $this->assertSame($expected . $destination, $pushCmd->asString());
41
    }
42
}
43