@@ -103,7 +103,7 @@ |
||
103 | 103 | $info = explode(' ', $stdIn[0]); |
104 | 104 | // If we find a rewritten commit, we return the first commit before the rewritten one. |
105 | 105 | // If we do not find any rewritten commits (awkward) we use the last ref-log position. |
106 | - return isset($info[1]) ? $info[1] . '^' : 'HEAD@{1}'; |
|
106 | + return isset($info[1]) ? $info[1] . '^' : 'HEAD@{1}'; |
|
107 | 107 | } |
108 | 108 | return $io->getArgument('previousHead', 'HEAD@{1}'); |
109 | 109 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | |
49 | 49 | // the config wll return the actually called config and then the virtual hook config |
50 | 50 | $config->expects($this->exactly(2)) |
51 | - ->method('getHookConfig') |
|
52 | - ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig); |
|
51 | + ->method('getHookConfig') |
|
52 | + ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig); |
|
53 | 53 | |
54 | 54 | $io->expects($this->atLeast(1))->method('write'); |
55 | 55 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | // the config wll return the actually called config and then the virtual hook config |
83 | 83 | $config->expects($this->exactly(2)) |
84 | - ->method('getHookConfig') |
|
85 | - ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig); |
|
84 | + ->method('getHookConfig') |
|
85 | + ->willReturnOnConsecutiveCalls($hookConfig, $vHookConfig); |
|
86 | 86 | |
87 | 87 | $io->expects($this->atLeast(1))->method('write'); |
88 | 88 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $config->expects($this->exactly(9))->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
35 | 35 | $io->method('ask')->will($this->onConsecutiveCalls('y', 'y', 'echo \'foo\'', 'n')); |
36 | 36 | |
37 | - $setup = new Advanced($io); |
|
37 | + $setup = new Advanced($io); |
|
38 | 38 | $setup->configureHooks($config); |
39 | 39 | } |
40 | 40 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $io->method('ask')->will($this->onConsecutiveCalls('y', 'y', '\\Foo\\Bar', 'y', 'n')); |
52 | 52 | $io->expects($this->once())->method('askAndValidate')->willReturn('foo:bar'); |
53 | 53 | |
54 | - $setup = new Advanced($io); |
|
54 | + $setup = new Advanced($io); |
|
55 | 55 | $setup->configureHooks($config); |
56 | 56 | } |
57 | 57 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $io = new NullIO(); |
35 | 35 | $config = new Config(CH_PATH_FILES . '/captainhook.json'); |
36 | - $repo = $this->createRepositoryMock(); |
|
36 | + $repo = $this->createRepositoryMock(); |
|
37 | 37 | $action = new Config\Action(Regex::class); |
38 | 38 | |
39 | 39 | $standard = new IsEmpty(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | CH_PATH_FILES . '/doesNotExist.txt', |
54 | 54 | CH_PATH_FILES . '/storage/empty.log', |
55 | 55 | ]]); |
56 | - $repo = $this->createRepositoryMock(); |
|
56 | + $repo = $this->createRepositoryMock(); |
|
57 | 57 | |
58 | 58 | $standard = new IsEmpty(); |
59 | 59 | $standard->execute($config, $io, $repo, $action); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | CH_PATH_FILES . '/storage/empty.log', // pass |
79 | 79 | CH_PATH_FILES . '/storage/test.json', // fail |
80 | 80 | ]]); |
81 | - $repo = $this->createRepositoryMock(); |
|
81 | + $repo = $this->createRepositoryMock(); |
|
82 | 82 | |
83 | 83 | $standard = new IsEmpty(); |
84 | 84 | $standard->execute($config, $io, $repo, $action); |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | |
77 | 77 | // every action has to get executed |
78 | 78 | $actionConfigFail->expects($this->atLeastOnce()) |
79 | - ->method('getAction') |
|
80 | - ->willReturn(CH_PATH_FILES . '/bin/failure'); |
|
79 | + ->method('getAction') |
|
80 | + ->willReturn(CH_PATH_FILES . '/bin/failure'); |
|
81 | 81 | |
82 | 82 | // so even if the first actions fails this action has to get executed |
83 | 83 | $actionConfigSuccess->expects($this->atLeastOnce()) |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | |
87 | 87 | $hookConfig->expects($this->once())->method('isEnabled')->willReturn(true); |
88 | 88 | $hookConfig->expects($this->once()) |
89 | - ->method('getActions') |
|
90 | - ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
89 | + ->method('getActions') |
|
90 | + ->willReturn([$actionConfigFail, $actionConfigSuccess]); |
|
91 | 91 | |
92 | 92 | $config->expects($this->once())->method('getHookConfig')->willReturn($hookConfig); |
93 | 93 | $io->expects($this->atLeast(1))->method('write'); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | public function createResolverMock(string $executable = 'vendor/bin/captainhook', bool $isPhar = false): Resolver |
30 | 30 | { |
31 | 31 | $repo = $this->getMockBuilder(Resolver::class) |
32 | - ->disableOriginalConstructor() |
|
33 | - ->getMock(); |
|
32 | + ->disableOriginalConstructor() |
|
33 | + ->getMock(); |
|
34 | 34 | |
35 | 35 | $repo->method('getExecutable')->willReturn($executable); |
36 | 36 | $repo->method('isPharRelease')->willReturn($isPhar); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | public function createRepositoryMock(string $root = ''): Repository |
48 | 48 | { |
49 | 49 | $repo = $this->getMockBuilder(Repository::class) |
50 | - ->disableOriginalConstructor() |
|
51 | - ->getMock(); |
|
50 | + ->disableOriginalConstructor() |
|
51 | + ->getMock(); |
|
52 | 52 | |
53 | 53 | $repo->method('getRoot')->willReturn($root); |
54 | 54 | $repo->method('getHooksDir')->willReturn($root . '/.git/hooks'); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | public function createGitInfoOperator(string $tag = 'v1.0.0', string $branch = 'master'): Info |
67 | 67 | { |
68 | 68 | $operator = $this->getMockBuilder(Info::class) |
69 | - ->disableOriginalConstructor() |
|
70 | - ->getMock(); |
|
69 | + ->disableOriginalConstructor() |
|
70 | + ->getMock(); |
|
71 | 71 | |
72 | 72 | $operator->method('getCurrentTag')->willReturn($tag); |
73 | 73 | $operator->method('getCurrentBranch')->willReturn($branch); |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | public function createGitDiffOperator(array $changedFiles = []): Diff |
85 | 85 | { |
86 | 86 | $operator = $this->getMockBuilder(Diff::class) |
87 | - ->disableOriginalConstructor() |
|
88 | - ->getMock(); |
|
87 | + ->disableOriginalConstructor() |
|
88 | + ->getMock(); |
|
89 | 89 | |
90 | 90 | $operator->method('getChangedFiles')->willReturn($changedFiles); |
91 | 91 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | public function createGitIndexOperator(array $stagedFiles = []): Index |
102 | 102 | { |
103 | 103 | $operator = $this->getMockBuilder(Index::class) |
104 | - ->disableOriginalConstructor() |
|
105 | - ->getMock(); |
|
104 | + ->disableOriginalConstructor() |
|
105 | + ->getMock(); |
|
106 | 106 | |
107 | 107 | $operator->method('getStagedFiles')->willReturn($stagedFiles); |
108 | 108 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->createGitInfoOperator('', 'Foo bar baz') |
50 | 50 | ); |
51 | 51 | |
52 | - $action = new Config\Action(EnsureNaming::class, ['regex' => '#bar#']); |
|
52 | + $action = new Config\Action(EnsureNaming::class, ['regex' => '#bar#']); |
|
53 | 53 | |
54 | 54 | $standard = new EnsureNaming(); |
55 | 55 | $standard->execute($config, $io, $repo, $action); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $repo->expects($this->once())->method('getInfoOperator')->willReturn( |
75 | 75 | $this->createGitInfoOperator('', 'Foo bar baz') |
76 | 76 | ); |
77 | - $action = new Config\Action( |
|
77 | + $action = new Config\Action( |
|
78 | 78 | EnsureNaming::class, |
79 | 79 | [ |
80 | 80 | 'regex' => '#.*#', |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $io = new NullIO(); |
101 | 101 | $config = new Config(CH_PATH_FILES . '/captainhook.json'); |
102 | - $repo = $this->createRepositoryMock(); |
|
102 | + $repo = $this->createRepositoryMock(); |
|
103 | 103 | $action = new Config\Action(EnsureNaming::class); |
104 | 104 | |
105 | 105 | $standard = new EnsureNaming(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $io = new NullIO(); |
35 | 35 | $config = new Config(CH_PATH_FILES . '/captainhook.json'); |
36 | - $repo = $this->createRepositoryMock(); |
|
36 | + $repo = $this->createRepositoryMock(); |
|
37 | 37 | $action = new Config\Action(DoesNotContainRegex::class); |
38 | 38 | |
39 | 39 | $standard = new DoesNotContainRegex(); |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | 'regex' => '#.#', |
132 | 132 | 'fileExtensions' => ['php'] |
133 | 133 | ]); |
134 | - $index = $this->createGitIndexOperator([ |
|
134 | + $index = $this->createGitIndexOperator([ |
|
135 | 135 | CH_PATH_FILES . '/storage/regextest1.txt' |
136 | 136 | ]); |
137 | - $index->method('getStagedFilesOfType')->willReturnCallback(function ($ext) { |
|
137 | + $index->method('getStagedFilesOfType')->willReturnCallback(function($ext) { |
|
138 | 138 | if ($ext === 'txt') { |
139 | 139 | return [ |
140 | 140 | CH_PATH_FILES . '/storage/regextest1.txt' |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | 'regex' => '#foo#', |
168 | 168 | 'fileExtensions' => ['txt'] |
169 | 169 | ]); |
170 | - $index = $this->createGitIndexOperator([ |
|
170 | + $index = $this->createGitIndexOperator([ |
|
171 | 171 | CH_PATH_FILES . '/storage/regextest1.txt' |
172 | 172 | ]); |
173 | - $index->method('getStagedFilesOfType')->willReturnCallback(function ($ext) { |
|
173 | + $index->method('getStagedFilesOfType')->willReturnCallback(function($ext) { |
|
174 | 174 | if ($ext === 'txt') { |
175 | 175 | return [ |
176 | 176 | CH_PATH_FILES . '/storage/regextest1.txt' |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | return []; |
180 | 180 | }); |
181 | - $repo = $this->createRepositoryMock(); |
|
181 | + $repo = $this->createRepositoryMock(); |
|
182 | 182 | $repo->method('getIndexOperator')->willReturn($index); |
183 | 183 | |
184 | 184 | $standard = new DoesNotContainRegex(); |