Completed
Push — develop ( c2a9e5...4f0107 )
by Siad
7s
created

UpdateCommandTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A updateCommand() 0 12 1
A updateCommandWithBranch() 0 13 1
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 UpdateCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function updateCommand()
23
    {
24
        $updateCmd = Factory::createUpdate();
25
        $updateCmd->setClean(true);
26
        $updateCmd->setCheck(true);
27
        $updateCmd->setDate('date');
28
        $updateCmd->setRev('rev');
29
30
        $expected = 'hg update --clean --check --date ' . escapeshellarg('date') . ' --rev ' . escapeshellarg('rev');
31
32
        $this->assertSame($expected, $updateCmd->asString());
33
    }
34
35
    /**
36
     * @test
37
     */
38
    public function updateCommandWithBranch()
39
    {
40
        $updateCmd = Factory::createUpdate();
41
        $updateCmd->setClean(true);
42
        $updateCmd->setCheck(true);
43
        $updateCmd->setDate('date');
44
        $updateCmd->setRev('rev');
45
        $updateCmd->setBranch('dev');
46
47
        $expected = 'hg update --clean --check --date ' . escapeshellarg('date') . ' --rev ' . escapeshellarg('rev') . ' \'dev\'';
48
49
        $this->assertSame($expected, $updateCmd->asString());
50
    }
51
}
52