AddremoveCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A addremoveCommand() 0 20 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 AddremoveCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function addremoveCommand()
23
    {
24
        $addremoveCmd = Factory::createAddremove();
25
        $addremoveCmd->addFile('C:\\xampp\\file1\\');
26
        $addremoveCmd->addFile('C:\\xampp\\file2\\');
27
        $addremoveCmd->setSimilarity('50');
28
        $addremoveCmd->addInclude('includePattern');
29
        $addremoveCmd->addExclude('excludePattern');
30
        $addremoveCmd->setDryRun(true);
31
32
        $file = '\'C:\xampp\file1\\\' \'C:\xampp\file2\\\'';
33
        $expected = 'hg addremove --similarity ' . escapeshellarg('50') . ' --include includePattern --exclude excludePattern --dry-run ';
34
35
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
36
            $file = str_replace("'", '"', $file);
37
        }
38
39
        $this->assertSame($file, implode(' ', $addremoveCmd->getFile()));
40
        $this->assertSame($expected . $file, $addremoveCmd->asString());
41
    }
42
}
43