Passed
Push — master ( b89ee9...82ea21 )
by Sebastian
03:18
created

CliTest   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\Application;
13
14
use PHPUnit\Framework\TestCase;
1 ignored issue
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Symfony\Component\Console\Input\ArrayInput;
16
use Symfony\Component\Console\Output\NullOutput;
17
18
class CliTest 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 Cli('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 Cli('captainhook');
55
        $app->setAutoExit(false);
56
        $app->run($input, $output);
57
    }
58
}
59