1616
1717class FactoryTest extends TestCase
1818{
19- /**
20- * Tests Factory::create
21- *
22- * @throws \Exception
23- */
2419 public function testCreate (): void
2520 {
2621 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid.json ' ));
@@ -29,23 +24,13 @@ public function testCreate(): void
2924 $ this ->assertCount (1 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
3025 }
3126
32- /**
33- * Tests Factory::create
34- *
35- * @throws \Exception
36- */
3727 public function testOverwriteConfigSettingsBySettingsConfigFile (): void
3828 {
3929 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/config-file/captainhook.json ' ));
4030
4131 $ this ->assertEquals ('quiet ' , $ config ->getVerbosity ());
4232 }
4333
44- /**
45- * Tests Factory::create
46- *
47- * @throws \Exception
48- */
4934 public function testCreateWithAbsoluteGitDir (): void
5035 {
5136 $ config = Factory::create (
@@ -58,11 +43,6 @@ public function testCreateWithAbsoluteGitDir(): void
5843 $ this ->assertEquals ('/foo ' , $ config ->getGitDirectory ());
5944 }
6045
61- /**
62- * Tests Factory::create
63- *
64- * @throws \Exception
65- */
6646 public function testCreateWithInvalidPhpPath (): void
6747 {
6848 $ this ->expectException (Exception::class);
@@ -73,11 +53,6 @@ public function testCreateWithInvalidPhpPath(): void
7353 );
7454 }
7555
76- /**
77- * Tests Factory::create
78- *
79- * @throws \Exception
80- */
8156 public function testCreateWithRelativeGitDir (): void
8257 {
8358 $ path = realpath (CH_PATH_FILES . '/config/valid.json ' );
@@ -88,9 +63,6 @@ public function testCreateWithRelativeGitDir(): void
8863 $ this ->assertEquals (dirname ($ path ) . DIRECTORY_SEPARATOR . '../.git ' , $ config ->getGitDirectory ());
8964 }
9065
91- /**
92- * Tests Factory::create
93- */
9466 public function testCreateWithRunConfig (): void
9567 {
9668 $ path = realpath (CH_PATH_FILES . '/config/valid-run-config-nested.json ' );
@@ -101,9 +73,6 @@ public function testCreateWithRunConfig(): void
10173 $ this ->assertEquals ('/docker/.git ' , $ config ->getRunConfig ()->getGitPath ());
10274 }
10375
104- /**
105- * Tests Factory::create
106- */
10776 public function testCreateWithRunConfigLegacy (): void
10877 {
10978 $ path = realpath (CH_PATH_FILES . '/config/valid-run-config-legacy.json ' );
@@ -114,11 +83,6 @@ public function testCreateWithRunConfigLegacy(): void
11483 $ this ->assertEquals ('/docker/.git ' , $ config ->getRunConfig ()->getGitPath ());
11584 }
11685
117- /**
118- * Tests Factory::create
119- *
120- * @throws \Exception
121- */
12286 public function testCreateWithConditions (): void
12387 {
12488 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-conditions.json ' ));
@@ -127,35 +91,20 @@ public function testCreateWithConditions(): void
12791 $ this ->assertCount (1 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
12892 }
12993
130- /**
131- * Tests Factory::create
132- *
133- * @throws \Exception
134- */
13594 public function testCreateWithSettings (): void
13695 {
13796 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-conditions.json ' ));
13897
13998 $ this ->assertTrue ($ config ->getHookConfig ('pre-commit ' )->getActions ()[0 ]->isFailureAllowed ());
14099 }
141100
142- /**
143- * Tests Factory::create
144- *
145- * @throws \Exception
146- */
147101 public function testCreateWithCrazyPHPPath (): void
148102 {
149103 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-strange-settings.json ' ));
150104
151105 $ this ->assertEquals ("tests/_files/bin/success foo " , $ config ->getPhpPath ());
152106 }
153107
154- /**
155- * Tests Factory::create
156- *
157- * @throws \Exception
158- */
159108 public function testCreateWithAllSetting (): void
160109 {
161110 $ path = realpath (CH_PATH_FILES . '/config/valid-with-all-settings.json ' );
@@ -172,11 +121,6 @@ public function testCreateWithAllSetting(): void
172121 $ this ->assertEquals (false , $ config ->failOnFirstError ());
173122 }
174123
175- /**
176- * Tests Factory::create
177- *
178- * @throws \Exception
179- */
180124 public function testCreateWithIncludes (): void
181125 {
182126 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-includes.json ' ));
@@ -185,11 +129,6 @@ public function testCreateWithIncludes(): void
185129 $ this ->assertCount (2 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
186130 }
187131
188- /**
189- * Tests Factory::create
190- *
191- * @throws \Exception
192- */
193132 public function testCreateWithValidNestedIncludes (): void
194133 {
195134 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-nested-includes.json ' ));
@@ -200,11 +139,6 @@ public function testCreateWithValidNestedIncludes(): void
200139 $ this ->assertCount (2 , $ config ->getHookConfig ('pre-push ' )->getActions ());
201140 }
202141
203- /**
204- * Tests Factory::create
205- *
206- * @throws \Exception
207- */
208142 public function testCreateWithInvalidNestedIncludes (): void
209143 {
210144 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/invalid-with-nested-includes.json ' ));
@@ -213,22 +147,12 @@ public function testCreateWithInvalidNestedIncludes(): void
213147 $ this ->assertCount (2 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
214148 }
215149
216- /**
217- * Tests Factory::create
218- *
219- * @throws \Exception
220- */
221150 public function testCreateWithInvalidIncludes (): void
222151 {
223152 $ this ->expectException (Exception::class);
224153 Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-invalid-includes.json ' ));
225154 }
226155
227- /**
228- * Tests Factory::create
229- *
230- * @throws \Exception
231- */
232156 public function testCreateEmptyWithIncludes (): void
233157 {
234158 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/empty-with-includes.json ' ));
@@ -237,11 +161,6 @@ public function testCreateEmptyWithIncludes(): void
237161 $ this ->assertCount (1 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
238162 }
239163
240- /**
241- * Tests Factory::create
242- *
243- * @throws \Exception
244- */
245164 public function testCreateWithNestedAndConditions (): void
246165 {
247166 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-nested-and-conditions.json ' ));
@@ -250,23 +169,13 @@ public function testCreateWithNestedAndConditions(): void
250169 $ this ->assertCount (1 , $ config ->getHookConfig ('pre-commit ' )->getActions ());
251170 }
252171
253- /**
254- * Tests Factory::create
255- *
256- * @throws \Exception
257- */
258172 public function testWithMainConfigurationOverridingInclude (): void
259173 {
260174 $ config = Factory::create (realpath (CH_PATH_FILES . '/config/valid-with-disabled-action.json ' ));
261175
262176 $ this ->assertFalse ($ config ->getHookConfig ('pre-commit ' )->isEnabled ());
263177 }
264178
265- /**
266- * Tests Factory::create
267- *
268- * @throws \Exception
269- */
270179 public function testMaxIncludeLevel (): void
271180 {
272181 // one of the included files will not be loaded because of the includes-level value of 2
0 commit comments