Passed
Push — main ( cebfe5...3df9c7 )
by Sebastian
04:33
created

FailureTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
c 0
b 0
f 0
dl 0
loc 27
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExecute() 0 16 1
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[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
12
namespace CaptainHook\App\Hook\Debug;
13
14
use CaptainHook\App\Config\Action;
15
use CaptainHook\App\Config\Mockery as ConfigMockery;
16
use CaptainHook\App\Console\IO\Mockery as IOMockery;
17
use CaptainHook\App\Hook\Debug;
18
use CaptainHook\App\Mockery as CHMockery;
19
use Exception;
20
use PHPUnit\Framework\TestCase;
21
22
class FailureTest extends TestCase
23
{
24
    use ConfigMockery;
25
    use IOMockery;
26
    use CHMockery;
27
28
    /**
29
     * Tests Debug::execute
30
     *
31
     * @throws \Exception
32
     */
33
    public function testExecute(): void
34
    {
35
        $this->expectException(Exception::class);
36
37
        $config       = $this->createConfigMock(true);
38
        $io           = $this->createIOMock();
39
        $repository   = $this->createRepositoryMock();
40
        $action       = new Action('\\' . Debug::class);
41
        $infoOperator = $this->createGitInfoOperator('1.0.0');
42
43
        $io->expects($this->once())->method('getArguments')->willReturn(['foo' => 'bar']);
44
        $io->expects($this->atLeast(3))->method('write');
45
        $repository->expects($this->exactly(1))->method('getInfoOperator')->willReturn($infoOperator);
46
47
        $debug = new Failure();
48
        $debug->execute($config, $io, $repository, $action);
49
    }
50
}
51