Completed
Push — master ( 41ae82...437c90 )
by Dave
13s queued 11s
created

GitCliWrapperTest::testGetGitShaCommandFails()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Tests\Unit\Plugins\GitDiffHistoryAnalyser\internal;
6
7
use DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Common\ProjectRoot;
8
use DaveLiddament\StaticAnalysisResultsBaseliner\Plugins\GitDiffHistoryAnalyser\GitCommit;
9
use DaveLiddament\StaticAnalysisResultsBaseliner\Plugins\GitDiffHistoryAnalyser\GitException;
10
use DaveLiddament\StaticAnalysisResultsBaseliner\Plugins\GitDiffHistoryAnalyser\internal\GitCliWrapper;
11
use PHPUnit\Framework\TestCase;
12
13
class GitCliWrapperTest extends TestCase
14
{
15
    public function testGitDiffCommandFails(): void
16
    {
17
        $projectRoot = new ProjectRoot(__DIR__, __DIR__);
18
        $gitCliWrapper = new GitCliWrapper();
19
        $nonExistantGitSha = new GitCommit('0000000000000000000000000000000000000000');
20
        $this->expectException(GitException::class);
21
        $gitCliWrapper->getGitDiff($projectRoot, $nonExistantGitSha);
22
    }
23
24
    public function testGetGitShaCommandFails(): void
25
    {
26
        $projectRoot = new ProjectRoot(__DIR__, __DIR__);
27
        $gitCliWrapper = new GitCliWrapper();
28
        $this->expectException(GitException::class);
29
        $gitCliWrapper->getCurrentSha($projectRoot);
30
    }
31
}
32