Completed
Push — develop ( 5f7df1...9cb564 )
by Matteo
10s
created

DiffTreeCommandTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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\Command\DiffTreeCommand;
17
use \GitElephant\TestCase;
18
use \GitElephant\Objects\Commit;
19
20
/**
21
 * DiffTreeCommandTest
22
 *
23
 * @author Matteo Giachino <[email protected]>
24
 */
25
26
class DiffTreeCommandTest extends TestCase
27
{
28
    /**
29
     * set up
30
     */
31
    public function setUp()
32
    {
33
        $this->initRepository();
34
        $this->getRepository()->init();
35
        $this->addFile('foo');
36
        $this->getRepository()->commit('first commit', true);
37
    }
38
39
    /**
40
     * set up
41
     */
42
    public function testRootDiff()
43
    {
44
        $dtc = DiffTreeCommand::getInstance();
45
        $commit = $this->getRepository()->getCommit();
46
        $command = $dtc->rootDiff($commit);
47
        $this->assertEquals(
48
            sprintf("diff-tree '--cc' '--root' '--dst-prefix=DST/' '--src-prefix=SRC/' '%s'", $commit),
49
            $command
50
        );
51
        $this->addFile('test');
52
        $this->getRepository()->commit('test commit', true);
53
        $this->setExpectedException('InvalidArgumentException');
54
        $this->fail($dtc->rootDiff($this->getRepository()->getCommit()));
55
    }
56
}
57