MvCommandTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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