@@ -115,98 +115,98 @@ public function testInstallPreCommitHook(): void
115
115
$ this ->assertTrue ($ repo ->hookExists ('pre-commit ' ));
116
116
}
117
117
118
- /**
119
- * Tests Install::run
120
- *
121
- * @throws \Exception
122
- */
123
- public function testInstallMultipleHooks (): void
124
- {
125
- $ repo = new DummyRepo ();
126
- $ output = new NullOutput ();
127
- $ input = new ArrayInput (
128
- [
129
- 'hook ' => 'pre-commit,pre-push,post-checkout ' ,
130
- '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
131
- '--git-directory ' => $ repo ->getGitDir ()
132
- ]
133
- );
134
-
135
- $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
136
- $ install ->run ($ input , $ output );
137
-
138
- $ this ->assertTrue ($ repo ->hookExists ('pre-commit ' ));
139
- $ this ->assertTrue ($ repo ->hookExists ('pre-push ' ));
140
- $ this ->assertTrue ($ repo ->hookExists ('post-checkout ' ));
141
- }
142
-
143
- /**
144
- * Tests Install::run
145
- *
146
- * @throws \Exception
147
- */
148
- public function testInstallMultipleHooksWithSpacesAfterAndBetweenSeparator (): void
149
- {
150
- $ repo = new DummyRepo ();
151
- $ output = new NullOutput ();
152
- $ input = new ArrayInput (
153
- [
154
- 'hook ' => ' pre-commit , pre-push , post-checkout, post-commit ' ,
155
- '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
156
- '--git-directory ' => $ repo ->getGitDir ()
157
- ]
158
- );
159
-
160
- $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
161
- $ install ->run ($ input , $ output );
162
-
163
- $ this ->assertTrue ($ repo ->hookExists ('pre-commit ' ));
164
- $ this ->assertTrue ($ repo ->hookExists ('pre-push ' ));
165
- $ this ->assertTrue ($ repo ->hookExists ('post-checkout ' ));
166
- }
167
-
168
- /**
169
- * Tests Install::run
170
- *
171
- * @throws \Exception
172
- */
173
- public function testInstallMultipleHooksWithOneWrong (): void
174
- {
175
- $ this ->expectException (\CaptainHook \App \Exception \InvalidHookName::class);
176
- $ repo = new DummyRepo ();
177
- $ output = new NullOutput ();
178
- $ input = new ArrayInput (
179
- [
180
- 'hook ' => 'pre-commit,pre-push,post-checkout,something-wrong ' ,
181
- '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
182
- '--git-directory ' => $ repo ->getGitDir ()
183
- ]
184
- );
185
-
186
- $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
187
- $ install ->run ($ input , $ output );
188
- }
189
-
190
-
191
- /**
192
- * Tests Install::run
193
- *
194
- * @throws \Exception
195
- */
196
- public function testInstallMultipleHooksWithMultipleWrong (): void
197
- {
198
- $ this ->expectException (\CaptainHook \App \Exception \InvalidHookName::class);
199
- $ repo = new DummyRepo ();
200
- $ output = new NullOutput ();
201
- $ input = new ArrayInput (
202
- [
203
- 'hook ' => 'pre-commit,pre-push,post-checkout,something-wrong1,something-wrong2 ' ,
204
- '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
205
- '--git-directory ' => $ repo ->getGitDir ()
206
- ]
207
- );
208
-
209
- $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
210
- $ install ->run ($ input , $ output );
211
- }
118
+ /**
119
+ * Tests Install::run
120
+ *
121
+ * @throws \Exception
122
+ */
123
+ public function testInstallMultipleHooks (): void
124
+ {
125
+ $ repo = new DummyRepo ();
126
+ $ output = new NullOutput ();
127
+ $ input = new ArrayInput (
128
+ [
129
+ 'hook ' => 'pre-commit,pre-push,post-checkout ' ,
130
+ '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
131
+ '--git-directory ' => $ repo ->getGitDir (),
132
+ ]
133
+ );
134
+
135
+ $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
136
+ $ install ->run ($ input , $ output );
137
+
138
+ $ this ->assertTrue ($ repo ->hookExists ('pre-commit ' ));
139
+ $ this ->assertTrue ($ repo ->hookExists ('pre-push ' ));
140
+ $ this ->assertTrue ($ repo ->hookExists ('post-checkout ' ));
141
+ }
142
+
143
+ /**
144
+ * Tests Install::run
145
+ *
146
+ * @throws \Exception
147
+ */
148
+ public function testInstallMultipleHooksWithSpacesAfterAndBetweenSeparator (): void
149
+ {
150
+ $ repo = new DummyRepo ();
151
+ $ output = new NullOutput ();
152
+ $ input = new ArrayInput (
153
+ [
154
+ 'hook ' => ' pre-commit , pre-push , post-checkout, post-commit ' ,
155
+ '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
156
+ '--git-directory ' => $ repo ->getGitDir (),
157
+ ]
158
+ );
159
+
160
+ $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
161
+ $ install ->run ($ input , $ output );
162
+
163
+ $ this ->assertTrue ($ repo ->hookExists ('pre-commit ' ));
164
+ $ this ->assertTrue ($ repo ->hookExists ('pre-push ' ));
165
+ $ this ->assertTrue ($ repo ->hookExists ('post-checkout ' ));
166
+ }
167
+
168
+ /**
169
+ * Tests Install::run
170
+ *
171
+ * @throws \Exception
172
+ */
173
+ public function testInstallMultipleHooksWithOneWrong (): void
174
+ {
175
+ $ this ->expectException (\CaptainHook \App \Exception \InvalidHookName::class);
176
+ $ repo = new DummyRepo ();
177
+ $ output = new NullOutput ();
178
+ $ input = new ArrayInput (
179
+ [
180
+ 'hook ' => 'pre-commit,pre-push,post-checkout,something-wrong ' ,
181
+ '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
182
+ '--git-directory ' => $ repo ->getGitDir (),
183
+ ]
184
+ );
185
+
186
+ $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
187
+ $ install ->run ($ input , $ output );
188
+ }
189
+
190
+
191
+ /**
192
+ * Tests Install::run
193
+ *
194
+ * @throws \Exception
195
+ */
196
+ public function testInstallMultipleHooksWithMultipleWrong (): void
197
+ {
198
+ $ this ->expectException (\CaptainHook \App \Exception \InvalidHookName::class);
199
+ $ repo = new DummyRepo ();
200
+ $ output = new NullOutput ();
201
+ $ input = new ArrayInput (
202
+ [
203
+ 'hook ' => 'pre-commit,pre-push,post-checkout,something-wrong1,something-wrong2 ' ,
204
+ '--configuration ' => CH_PATH_FILES . '/template/captainhook.json ' ,
205
+ '--git-directory ' => $ repo ->getGitDir (),
206
+ ]
207
+ );
208
+
209
+ $ install = new Install (new Resolver (CH_PATH_FILES . '/bin/captainhook ' ));
210
+ $ install ->run ($ input , $ output );
211
+ }
212
212
}
0 commit comments