FetchCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetCommandLine() 0 7 1
A testGetCommandLineWithTags() 0 11 1
1
<?php
2
3
/**
4
 * Moodle component manager.
5
 *
6
 * @author Luke Carrier <[email protected]>
7
 * @copyright 2016 Luke Carrier
8
 * @license GPL-3.0+
9
 */
10
11
namespace ComponentManager\Test\VersionControl\Git\Command;
12
13
use ComponentManager\VersionControl\Git\Command\FetchCommand;
14
use PHPUnit\Framework\TestCase;
15
16
class FetchCommandTest extends TestCase {
17
    public function testGetCommandLine() {
18
        $command = new FetchCommand();
19
        $this->assertEquals(['fetch'], $command->getCommandLine());
20
21
        $command = new FetchCommand('upstream');
22
        $this->assertEquals(['fetch', 'upstream'], $command->getCommandLine());
23
    }
24
25
    public function testGetCommandLineWithTags() {
26
        $command = new FetchCommand();
27
        $command->setTags(true);
28
        $this->assertEquals(['fetch', '--tags'], $command->getCommandLine());
29
30
        $command = new FetchCommand('upstream');
31
        $command->setTags(false);
32
        $this->assertEquals(
33
                ['fetch', '--no-tags', 'upstream'],
34
                $command->getCommandLine());
35
    }
36
}
37