LogCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 1
A testShowObjectLog() 0 14 1
1
<?php
2
3
/**
4
 * This file is part of the GitElephant package.
5
 *
6
 * (c) Matteo Giachino <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Just for fun...
12
 */
13
14
namespace GitElephant\Command;
15
16
use GitElephant\TestCase;
17
18
/**
19
 * DiffTreeCommandTest
20
 *
21
 * @author Matteo Giachino <[email protected]>
22
 */
23
24
class LogCommandTest extends TestCase
25
{
26
    /**
27
     * set up
28
     */
29
    public function setUp(): void
30
    {
31
        $this->initRepository();
32
        $this->getRepository()->init();
33
        $this->addFile('foo');
34
        $this->addFolder('test-folder');
35
        $this->addFile('test-file', 'test-folder', 'test');
36
        $this->getRepository()->commit('first commit', true);
37
    }
38
39
    /**
40
     * testShowObjectLog
41
     */
42
    public function testShowObjectLog(): void
43
    {
44
        $branch = $this->getRepository()->getBranch('master');
45
        $obj = $this->getRepository()->getTree('HEAD', 'test-folder/test-file')->getBlob();
46
        $lc = LogCommand::getInstance();
47
        $this->assertEquals(
48
            "log '-s' '--pretty=raw' '--no-color' -- 'test-folder/test-file'",
49
            $lc->showObjectLog($obj)
50
        );
51
        $this->assertEquals(
52
            "log '-s' '--pretty=raw' '--no-color' 'master' -- 'test-folder/test-file'",
53
            $lc->showObjectLog($obj, $branch)
54
        );
55
    }
56
}
57