|
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\Config; |
|
13
|
|
|
|
|
14
|
|
|
use CaptainHook\App\Config as CHConfig; |
|
15
|
|
|
use PHPUnit\Framework\MockObject\MockBuilder; |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
trait Mockery |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* Create config mock |
|
21
|
|
|
* |
|
22
|
|
|
* @param bool $loadedFromFile |
|
23
|
|
|
* @param string $path |
|
24
|
|
|
* @return \CaptainHook\App\Config&\PHPUnit\Framework\MockObject\MockObject |
|
25
|
|
|
*/ |
|
26
|
|
|
public function createConfigMock(bool $loadedFromFile = false, string $path = ''): CHConfig |
|
27
|
|
|
{ |
|
28
|
|
|
$config = $this->getMockBuilder(CHConfig::class) |
|
29
|
|
|
->disableOriginalConstructor() |
|
30
|
|
|
->getMock(); |
|
31
|
|
|
|
|
32
|
|
|
$config->method('isLoadedFromFile')->willReturn($loadedFromFile); |
|
33
|
|
|
$config->method('getPath')->willReturn($path); |
|
34
|
|
|
|
|
35
|
|
|
return $config; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Create hook configuration mock |
|
40
|
|
|
* |
|
41
|
|
|
* @return \CaptainHook\App\Config\Hook&\PHPUnit\Framework\MockObject\MockObject |
|
42
|
|
|
*/ |
|
43
|
|
|
public function createHookConfigMock() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->getMockBuilder(Hook::class) |
|
46
|
|
|
->disableOriginalConstructor() |
|
47
|
|
|
->getMock(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Create Action configuration mock |
|
52
|
|
|
* |
|
53
|
|
|
* @return \CaptainHook\App\Config\Action&\PHPUnit\Framework\MockObject\MockObject |
|
54
|
|
|
*/ |
|
55
|
|
|
public function createActionConfigMock() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->getMockBuilder(Action::class) |
|
58
|
|
|
->disableOriginalConstructor() |
|
59
|
|
|
->getMock(); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Create Action configuration mock |
|
64
|
|
|
* |
|
65
|
|
|
* @return \CaptainHook\App\Config\Action&\PHPUnit\Framework\MockObject\MockObject |
|
66
|
|
|
*/ |
|
67
|
|
|
public function createPluginConfigMock(): Plugin |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->getMockBuilder(Plugin::class) |
|
70
|
|
|
->disableOriginalConstructor() |
|
71
|
|
|
->getMock(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param $type |
|
76
|
|
|
* @return \PHPUnit\Framework\MockObject\MockBuilder |
|
77
|
|
|
*/ |
|
78
|
|
|
abstract public function getMockBuilder(string $type): MockBuilder; |
|
79
|
|
|
} |
|
80
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths