Passed
Push — master ( b34030...56c38f )
by Sebastian
03:50
created

CliTest::testExecuteFailure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace sebastianfeldmann\CaptainHook\Runner\Action;
11
12
use sebastianfeldmann\CaptainHook\Runner\BaseTestRunner;
13
14
class CliTest extends BaseTestRunner
15
{
16
    /**
17
     * Tests Cli::execute
18
     */
19
    public function testExecuteSuccess()
20
    {
21
        $config = $this->getConfigMock();
22
        $io     = $this->getIOMock();
23
        $repo   = $this->getRepositoryMock();
24
        $action = $this->getActionConfigMock();
25
26
        $cmd = HMU_PATH_FILES . '/bin/success';
27
28
        $io->expects($this->once())->method('write');
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<sebastianfeldmann...k\Console\IO\DefaultIO>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
        $action->expects($this->once())->method('getAction')->willReturn($cmd);
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<sebastianfeldmann...tainHook\Config\Action>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
31
        $cli = new Cli();
32
        $cli->execute($config, $io, $repo, $action);
33
    }
34
35
    /**
36
     * Tests Cli::execute
37
     *
38
     * @expectedException \Exception
39
     */
40 View Code Duplication
    public function testExecuteFailure()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $config = $this->getConfigMock();
43
        $io     = $this->getIOMock();
44
        $repo   = $this->getRepositoryMock();
45
        $action = $this->getActionConfigMock();
46
47
        $cmd = HMU_PATH_FILES . '/bin/failure';
48
49
        $action->expects($this->once())->method('getAction')->willReturn($cmd);
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<sebastianfeldmann...tainHook\Config\Action>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
51
        $cli = new Cli();
52
        $cli->execute($config, $io, $repo, $action);
53
    }
54
}
55