@@ -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 | } |
@@ -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(); |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | { |
47 | 47 | parent::configure(); |
48 | 48 | $this->setName('hook:' . $this->hookName) |
49 | - ->setDescription('Run git ' . $this->hookName . ' hook.') |
|
50 | - ->setHelp('This command executes the ' . $this->hookName . ' hook.'); |
|
49 | + ->setDescription('Run git ' . $this->hookName . ' hook.') |
|
50 | + ->setHelp('This command executes the ' . $this->hookName . ' hook.'); |
|
51 | 51 | |
52 | 52 | $this->addOption( |
53 | 53 | 'bootstrap', |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | private function handleError(OutputInterface $output, Exception $e): int |
121 | 121 | { |
122 | 122 | $error = IOUtil::$tplError |
123 | - . PHP_EOL . IOUtil::getLineSeparator() . PHP_EOL |
|
124 | - . IOUtil::formatHeadline(get_class($e), 80, '>', '<') . PHP_EOL |
|
125 | - . IOUtil::getLineSeparator() . PHP_EOL |
|
126 | - . $e->getMessage() . PHP_EOL; |
|
123 | + . PHP_EOL . IOUtil::getLineSeparator() . PHP_EOL |
|
124 | + . IOUtil::formatHeadline(get_class($e), 80, '>', '<') . PHP_EOL |
|
125 | + . IOUtil::getLineSeparator() . PHP_EOL |
|
126 | + . $e->getMessage() . PHP_EOL; |
|
127 | 127 | |
128 | 128 | $output->writeLn($error); |
129 | 129 |
@@ -123,7 +123,7 @@ |
||
123 | 123 | . PHP_EOL . IOUtil::getLineSeparator() . PHP_EOL |
124 | 124 | . IOUtil::formatHeadline(get_class($e), 80, '>', '<') . PHP_EOL |
125 | 125 | . IOUtil::getLineSeparator() . PHP_EOL |
126 | - . $e->getMessage() . PHP_EOL; |
|
126 | + . $e->getMessage() . PHP_EOL; |
|
127 | 127 | |
128 | 128 | $output->writeLn($error); |
129 | 129 |
@@ -103,7 +103,7 @@ |
||
103 | 103 | $io = new NullIO(); |
104 | 104 | $config = new Config(CH_PATH_FILES . '/captainhook.json'); |
105 | 105 | $action = new Config\Action(IsEmpty::class, ['files' => [ |
106 | - CH_PATH_FILES . '/doesNotExist.txt', // pass |
|
106 | + CH_PATH_FILES . '/doesNotExist.txt', // pass |
|
107 | 107 | CH_PATH_FILES . '/storage/empty.log', // pass |
108 | 108 | CH_PATH_FILES . '/storage/test.json', // fail |
109 | 109 | ]]); |