1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpGitHooks\Module\Configuration\Tests\Stub; |
4
|
|
|
|
5
|
|
|
use PhpGitHooks\Module\Configuration\Contract\Response\CommitMsgResponse; |
6
|
|
|
use PhpGitHooks\Module\Configuration\Contract\Response\ConfigurationDataResponse; |
7
|
|
|
use PhpGitHooks\Module\Configuration\Contract\Response\PreCommitResponse; |
8
|
|
|
use PhpGitHooks\Module\Configuration\Contract\Response\PrePushResponse; |
9
|
|
|
|
10
|
|
|
final class ConfigurationDataResponseStub |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param PreCommitResponse $preCommitResponse |
14
|
|
|
* @param CommitMsgResponse $commitMsgResponse |
15
|
|
|
* @param PrePushResponse $prePushResponse |
16
|
|
|
* |
17
|
|
|
* @return ConfigurationDataResponse |
18
|
|
|
*/ |
19
|
|
|
public static function create( |
20
|
|
|
PreCommitResponse $preCommitResponse, |
21
|
|
|
CommitMsgResponse $commitMsgResponse, |
22
|
|
|
PrePushResponse $prePushResponse |
23
|
|
|
) { |
24
|
|
|
return new ConfigurationDataResponse($preCommitResponse, $commitMsgResponse, $prePushResponse); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @return ConfigurationDataResponse |
29
|
|
|
*/ |
30
|
|
|
public static function createAllEnabled() |
31
|
|
|
{ |
32
|
|
|
return self::create( |
33
|
|
|
PreCommitResponseStub::createAllEnabled(), |
34
|
|
|
CommitMsgResponseStub::createEnabled(), |
35
|
|
|
PrePushResponseStub::createAllEnabled() |
36
|
|
|
); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param bool $preCommit |
41
|
|
|
* @param bool $commitMsg |
42
|
|
|
* @param bool $prePush |
43
|
|
|
* |
44
|
|
|
* @return ConfigurationDataResponse |
45
|
|
|
*/ |
46
|
|
|
public static function createCustom($preCommit, $commitMsg, $prePush) |
47
|
|
|
{ |
48
|
|
|
return self::create( |
49
|
|
|
PreCommitResponseStub::create( |
50
|
|
|
$preCommit, |
51
|
|
|
PreCommitResponseStub::GOOD_JOB, |
52
|
|
|
PreCommitResponseStub::FIX_YOUR_CODE, |
53
|
|
|
$preCommit, |
54
|
|
|
$preCommit, |
55
|
|
|
$preCommit, |
56
|
|
|
PhpMdResponseStub::create($preCommit, PhpMdResponseStub::OPTIONS), |
57
|
|
|
PhpCsResponseStub::create($preCommit, PhpCsResponseStub::STANDARD), |
58
|
|
|
PhpCsFixerResponseStub::create($preCommit, $preCommit, $preCommit, $preCommit, $preCommit), |
59
|
|
|
PhpUnitResponseStub::create($preCommit, $preCommit, PhpUnitResponseStub::OPTIONS), |
60
|
|
|
PhpUnitStrictCoverageResponseStub::create($preCommit, PhpUnitStrictCoverageResponseStub::MINIMUM) |
61
|
|
|
), |
62
|
|
|
CommitMsgResponseStub::create($commitMsg, CommitMsgResponseStub::REGULAR_EXPRESSION), |
63
|
|
|
PrePushResponseStub::create( |
64
|
|
|
$prePush, |
65
|
|
|
PrePushResponseStub::RIGHT_MESSAGE, |
66
|
|
|
PrePushResponseStub::ERROR_MESSAGE, |
67
|
|
|
PhpUnitResponseStub::create($prePush, $prePush, PhpUnitResponseStub::OPTIONS), |
68
|
|
|
PhpUnitStrictCoverageResponseStub::create($prePush, PhpUnitStrictCoverageResponseStub::MINIMUM) |
69
|
|
|
) |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|