ResolveCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveCommand() 0 24 2
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 ResolveCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function resolveCommand()
23
    {
24
        $resolveCmd = Factory::createResolve();
25
        $resolveCmd->addFile('C:\\xampp\\file1\\');
26
        $resolveCmd->addFile('C:\\xampp\\file2\\');
27
        $resolveCmd->setTool('testtool');
28
        $resolveCmd->addInclude('includePattern');
29
        $resolveCmd->addExclude('excludePattern');
30
        $resolveCmd->setAll(true);
31
        $resolveCmd->setList(true);
32
        $resolveCmd->setMark(true);
33
        $resolveCmd->setUnmark(true);
34
        $resolveCmd->setNoStatus(true);
35
36
        $file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
37
        $expected = 'hg resolve --all --list --mark --unmark --no-status --tool ' . escapeshellarg('testtool') . ' --include includePattern --exclude excludePattern ';
38
39
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
40
            $file = str_replace("'", '"', $file);
41
        }
42
43
        $this->assertSame($file, implode(' ', $resolveCmd->getFile()));
44
        $this->assertSame($expected . $file, $resolveCmd->asString());
45
    }
46
}
47