|
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 CaptainHook\App\Runner\Action; |
|
11
|
|
|
|
|
12
|
|
|
use CaptainHook\App\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'); |
|
|
|
|
|
|
29
|
|
|
$action->expects($this->once())->method('getAction')->willReturn($cmd); |
|
|
|
|
|
|
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() |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
$cli = new Cli(); |
|
52
|
|
|
$cli->execute($config, $io, $repo, $action); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
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.