Passed
Push — main ( a9710c...7f9cdf )
by Sebastian
03:36
created
tests/unit/Hook/Condition/FileChanged/OfTypeTest.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@
 block discarded – undo
37 37
         $io = $this->createIOMock();
38 38
         $io->method('getArgument')->willReturn('hook:pre-push');
39 39
         $io->expects($this->atLeastOnce())
40
-           ->method('getStandardInput')
41
-           ->willReturn(
42
-               [
43
-                   'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' .
44
-                   ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'
45
-               ]
46
-           );
40
+            ->method('getStandardInput')
41
+            ->willReturn(
42
+                [
43
+                    'refs/heads/main 9dfa0fa6221d75f48b2dfac359127324bedf8409' .
44
+                    ' refs/heads/main 8309f6e16097754469c485e604900c573bf2c5d8'
45
+                ]
46
+            );
47 47
         $operator   = $this->createGitDiffOperator();
48 48
         $repository = $this->createRepositoryMock('');
49 49
         $operator->method('getChangedFilesOfType')->willReturn(['fiz.php', 'foo.txt']);
Please login to merge, or discard this patch.
tests/unit/Hook/Branch/Action/EnsureNamingTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
tests/unit/Hook/File/Action/IsEmptyTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
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
         ]]);
Please login to merge, or discard this patch.
tests/unit/Hook/File/Action/DoesNotContainRegexTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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();
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             'regex'          => '#foo#',
106 106
             'fileExtensions' => ''
107 107
         ]);
108
-        $repo   = $this->createRepositoryMock();
108
+        $repo = $this->createRepositoryMock();
109 109
         $repo->method('getIndexOperator')->willReturn(
110 110
             $this->createGitIndexOperator([
111 111
                 CH_PATH_FILES . '/storage/regextest1.txt',
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
             'regex' => '#.#',
155 155
             'fileExtensions' => ['php']
156 156
         ]);
157
-        $index  = $this->createGitIndexOperator([
157
+        $index = $this->createGitIndexOperator([
158 158
             CH_PATH_FILES . '/storage/regextest1.txt'
159 159
         ]);
160
-        $index->method('getStagedFilesOfType')->willReturnCallback(function ($ext) {
160
+        $index->method('getStagedFilesOfType')->willReturnCallback(function($ext) {
161 161
             if ($ext === 'txt') {
162 162
                 return [
163 163
                     CH_PATH_FILES . '/storage/regextest1.txt'
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             'regex' => '#foo#',
190 190
             'fileExtensions' => ['txt']
191 191
         ]);
192
-        $index  = $this->createGitIndexOperator([
192
+        $index = $this->createGitIndexOperator([
193 193
             CH_PATH_FILES . '/storage/regextest1.txt'
194 194
         ]);
195
-        $index->method('getStagedFilesOfType')->willReturnCallback(function ($ext) {
195
+        $index->method('getStagedFilesOfType')->willReturnCallback(function($ext) {
196 196
             if ($ext === 'txt') {
197 197
                 return [
198 198
                     CH_PATH_FILES . '/storage/regextest1.txt'
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             }
201 201
             return [];
202 202
         });
203
-        $repo   = $this->createRepositoryMock();
203
+        $repo = $this->createRepositoryMock();
204 204
         $repo->method('getIndexOperator')->willReturn($index);
205 205
 
206 206
         $standard = new DoesNotContainRegex();
Please login to merge, or discard this patch.
tests/unit/Hook/File/Action/BlockSecretsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
             'blocked' => ['#f[a-z]+#'],
80 80
             'allowed' => ['#foo#']
81 81
         ]);
82
-        $repo   = $this->createRepositoryMock();
82
+        $repo = $this->createRepositoryMock();
83 83
         $repo->expects($this->atLeast(1))->method('getIndexOperator')->willReturn(
84 84
             $this->createGitIndexOperator([
85 85
                 CH_PATH_FILES . '/storage/secrets-ok.txt',
Please login to merge, or discard this patch.
tests/unit/Storage/File/XmlTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         $this->expectException(Exception::class);
25 25
 
26 26
         $path = realpath(CH_PATH_FILES . '/storage/invalid-xml.txt');
27
-        $file  = new Xml($path);
27
+        $file = new Xml($path);
28 28
         $file->read();
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
tests/unit/Mockery.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     public function createResolverMock(string $executable = 'vendor/bin/captainhook', bool $isPhar = false): Resolver
33 33
     {
34 34
         $repo = $this->getMockBuilder(Resolver::class)
35
-                     ->disableOriginalConstructor()
36
-                     ->getMock();
35
+                        ->disableOriginalConstructor()
36
+                        ->getMock();
37 37
 
38 38
         $repo->method('getExecutable')->willReturn($executable);
39 39
         $repo->method('isPharRelease')->willReturn($isPhar);
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     {
52 52
 
53 53
         $repo = $this->getMockBuilder(Repository::class)
54
-                     ->disableOriginalConstructor()
55
-                     ->getMock();
54
+                        ->disableOriginalConstructor()
55
+                        ->getMock();
56 56
 
57 57
         $repo->method('getRoot')->willReturn($root);
58 58
         $repo->method('getHooksDir')->willReturn($root . '/.git/hooks');
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
     public function createGitInfoOperator(string $tag = 'v1.0.0', string $branch = 'master'): Info
71 71
     {
72 72
         $operator = $this->getMockBuilder(Info::class)
73
-                         ->disableOriginalConstructor()
74
-                         ->getMock();
73
+                            ->disableOriginalConstructor()
74
+                            ->getMock();
75 75
 
76 76
         $operator->method('getCurrentTag')->willReturn($tag);
77 77
         $operator->method('getCurrentBranch')->willReturn($branch);
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
     public function createGitDiffOperator(array $changedFiles = []): Diff
89 89
     {
90 90
         $operator = $this->getMockBuilder(Diff::class)
91
-                         ->disableOriginalConstructor()
92
-                         ->getMock();
91
+                            ->disableOriginalConstructor()
92
+                            ->getMock();
93 93
 
94 94
         $operator->method('getChangedFiles')->willReturn($changedFiles);
95 95
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
     public function createGitIndexOperator(array $stagedFiles = []): Index
120 120
     {
121 121
         $operator = $this->getMockBuilder(Index::class)
122
-                         ->disableOriginalConstructor()
123
-                         ->getMock();
122
+                            ->disableOriginalConstructor()
123
+                            ->getMock();
124 124
 
125 125
         $operator->method('getStagedFiles')->willReturn($stagedFiles);
126 126
 
Please login to merge, or discard this patch.
src/Plugin/Hook/PreserveWorkingTree.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $this->io->write('<info>Unstaged intent-to-add files detected.</info>');
121 121
 
122 122
         $this->repository->getIndexOperator()->removeFiles(
123
-            array_map(function (Path $path): string {
123
+            array_map(function(Path $path): string {
124 124
                 return $path->getPath();
125 125
             }, $this->intentToAddFiles),
126 126
             false,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         }
142 142
 
143 143
         $this->repository->getIndexOperator()->recordIntentToAddFiles(
144
-            array_map(function (Path $path): string {
144
+            array_map(function(Path $path): string {
145 145
                 return $path->getPath();
146 146
             }, $this->intentToAddFiles)
147 147
         );
Please login to merge, or discard this patch.
src/Hooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
         return array_keys(
121 121
             array_filter(
122 122
                 self::$virtualHookTriggers,
123
-                function ($e) use ($virtualHook) {
123
+                function($e) use ($virtualHook) {
124 124
                     return $e === $virtualHook;
125 125
                 }
126 126
             )
Please login to merge, or discard this patch.