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

PostCommitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 12
c 1
b 0
f 0
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExecuteWithRelativeConfigPath() 0 20 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\Command\Hook;
13
14
use CaptainHook\App\Console\Runtime\Resolver;
15
use CaptainHook\App\Git\DummyRepo;
16
use Symfony\Component\Console\Input\ArrayInput;
17
use Symfony\Component\Console\Output\NullOutput;
18
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...
19
20
class PostCommitTest extends TestCase
21
{
22
    /**
23
     * Tests PostCommit::run
24
     *
25
     * @throws \Exception
26
     */
27
    public function testExecuteWithRelativeConfigPath(): void
28
    {
29
        $cwd = getcwd();
30
        chdir(CH_PATH_FILES);
31
32
        $repo   = new DummyRepo();
33
        $output = new NullOutput();
34
        $input  = new ArrayInput(
35
            [
36
                '--configuration' => './config/valid.json',
37
                '--git-directory' => $repo->getGitDir()
38
            ]
39
        );
40
41
        $cmd = new PostCommit(new Resolver());
42
        $cmd->run($input, $output);
43
44
        chdir($cwd);
45
46
        $this->assertTrue(true);
47
    }
48
}
49