TagCommandTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A tagCommand() 0 20 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 TagCommandTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @test
21
     */
22
    public function tagCommand()
23
    {
24
        $tagCmd = Factory::createTag();
25
        $tagCmd->addName('rev');
26
        $tagCmd->addName('rev2');
27
        $tagCmd->setForce(true);
28
        $tagCmd->setLocal(true);
29
        $tagCmd->setRev('test');
30
        $tagCmd->setRemove(true);
31
        $tagCmd->setEdit(true);
32
        $tagCmd->setMessage('text');
33
        $tagCmd->setDate('date');
34
        $tagCmd->setUser('user');
35
36
        $name = 'rev rev2';
37
        $expected = 'hg tag --force --local --rev ' . escapeshellarg('test') . ' --remove --edit --message ' . escapeshellarg('text') . ' --date ' . escapeshellarg('date') . ' --user ' . escapeshellarg('user') . ' ';
38
39
        $this->assertSame($name, implode(' ', $tagCmd->getName()));
40
        $this->assertSame($expected . $name, $tagCmd->asString());
41
    }
42
}
43