Completed
Pull Request — develop (#100)
by
unknown
03:44
created

MvCommandTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testRename() 0 9 1
1
<?php
2
/**
3
 * User: matteo
4
 * Date: 06/06/13
5
 * Time: 23.45
6
 * Just for fun...
7
 */
8
9
namespace GitElephant\Command;
10
11
use \GitElephant\TestCase;
12
13
/**
14
 * Class MvCommandTest
15
 *
16
 * @package GitElephant\Command
17
 */
18
class MvCommandTest extends TestCase
19
{
20
    /**
21
     * setUp
22
     */
23
    public function setUp()
24
    {
25
        $this->getRepository()->init();
26
        $this->addFile('test');
27
        $this->addFolder('test_folder');
28
        $this->addFile('test2', 'test_folder');
29
        $this->getRepository()->commit('test', true);
30
    }
31
32
    /**
33
     * testRename
34
     */
35
    public function testRename()
36
    {
37
        $mc = MvCommand::getInstance();
38
        $this->assertEquals("mv '-k' 'a' 'b'", $mc->rename('a', 'b'));
39
        $tree = $this->repository->getTree('HEAD', 'test');
40
        $this->assertEquals("mv '-k' 'test' 'b'", $mc->rename($tree->getBlob(), 'b'));
41
        $tree = $this->repository->getTree('HEAD', 'test_folder/test2');
42
        $this->assertEquals("mv '-k' 'test_folder/test2' 'b'", $mc->rename($tree->getBlob(), 'b'));
43
    }
44
}
45