Passed
Push — master ( 733e51...d67e24 )
by Sebastian
02:01
created

ApplicationTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 1
b 0
f 0
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testVersionOutput() 0 13 1
A testExecuteList() 0 12 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\Console;
13
14
use PHPUnit\Framework\TestCase;
15
use Symfony\Component\Console\Input\ArrayInput;
16
use Symfony\Component\Console\Output\NullOutput;
17
18
class ApplicationTest extends TestCase
19
{
20
    /**
21
     * Tests Cli::run
22
     *
23
     * @throws \Exception
24
     */
25
    public function testVersionOutput(): void
26
    {
27
        $input = new ArrayInput(['--version' => true]);
28
        $output = $this->getMockBuilder(NullOutput::class)
29
                       ->disableOriginalConstructor()
30
                       ->getMock();
31
32
        $output->expects($this->once())->method('writeLn');
33
34
35
        $app = new Application('captainhook');
36
        $app->setAutoExit(false);
37
        $app->run($input, $output);
38
    }
39
40
    /**
41
     * Tests Cli::run
42
     *
43
     * @throws \Exception
44
     */
45
    public function testExecuteList(): void
46
    {
47
        $input = new ArrayInput(['command' => 'list']);
48
        $output = $this->getMockBuilder(NullOutput::class)
49
                       ->disableOriginalConstructor()
50
                       ->getMock();
51
52
        $output->expects($this->atLeastOnce())->method('write');
53
54
        $app = new Application('captainhook');
55
        $app->setAutoExit(false);
56
        $app->run($input, $output);
57
    }
58
}
59