StatusCommandTest::statusCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
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 StatusCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function statusCommand()
23
    {
24
        $statusCmd = Factory::createStatus();
25
        $statusCmd->addFile('C:\\xampp\\file\\');
26
        $statusCmd->addInclude('includePattern');
27
        $statusCmd->addExclude('excludePattern');
28
        $statusCmd->setSubrepos(true);
29
30
        $file = '\'C:\xampp\file\\\'';
31
        $expected = 'hg status --include includePattern --exclude excludePattern --subrepos ';
32
33
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
34
            $file = str_replace("'", '"', $file);
35
        }
36
37
        $this->assertSame($file, implode(' ', $statusCmd->getFile()));
38
        $this->assertSame($expected . $file, $statusCmd->asString());
39
    }
40
}
41