@@ -19,7 +19,10 @@ class HooksTest extends AbstractTest
1919{
2020 private static $ symlinkOnWindows = null ;
2121
22- public static function setUpBeforeClass ()
22+ /**
23+ * @beforeClass
24+ */
25+ public static function setUpWindows ()
2326 {
2427 if (defined ('PHP_WINDOWS_VERSION_MAJOR ' )) {
2528 self ::$ symlinkOnWindows = true ;
@@ -52,6 +55,7 @@ public function assertHasHook($repository, $hook)
5255 $ file = $ this ->hookPath ($ repository , $ hook );
5356
5457 $ this ->assertTrue ($ repository ->getHooks ()->has ($ hook ), "hook $ hook in repository " );
58+
5559 $ this ->assertFileExists ($ file , "Hook $ hook is present " );
5660 }
5761
@@ -60,7 +64,12 @@ public function assertNoHook($repository, $hook)
6064 $ file = $ this ->hookPath ($ repository , $ hook );
6165
6266 $ this ->assertFalse ($ repository ->getHooks ()->has ($ hook ), "No hook $ hook in repository " );
63- $ this ->assertFileNotExists ($ file , "Hook $ hook is not present " );
67+
68+ if (method_exists ($ this , 'assertFileDoesNotExist ' )) {
69+ $ this ->assertFileDoesNotExist ($ file , "Hook $ hook is not present " );
70+ } else {
71+ $ this ->assertFileNotExists ($ file , "Hook $ hook is not present " );
72+ }
6473 }
6574
6675 /**
@@ -104,7 +113,12 @@ public function testSymlink($repository)
104113 $ repository ->getHooks ()->setSymlink ('foo ' , $ file );
105114
106115 $ this ->assertTrue (is_link ($ this ->hookPath ($ repository , 'foo ' )), 'foo hook is a symlink ' );
107- $ this ->assertEquals (str_replace ('\\' , '/ ' , $ file ), str_replace ('\\' , '/ ' , readlink ($ this ->hookPath ($ repository , 'foo ' ))), 'target of symlink is correct ' );
116+
117+ $ this ->assertEquals (
118+ str_replace ('\\' , '/ ' , $ file ),
119+ str_replace ('\\' , '/ ' , readlink ($ this ->hookPath ($ repository , 'foo ' ))),
120+ 'target of symlink is correct '
121+ );
108122 }
109123
110124 /**
@@ -147,6 +161,7 @@ public function testSet_Existing_ThrowsLogicException($repository)
147161 $ repository ->getHooks ()->set ('foo ' , 'bar ' );
148162
149163 $ this ->expectException (LogicException::class);
164+
150165 $ repository ->getHooks ()->set ('foo ' , 'bar ' );
151166 }
152167
@@ -159,7 +174,12 @@ public function testRemove($repository)
159174 touch ($ file );
160175
161176 $ repository ->getHooks ()->remove ('foo ' );
162- $ this ->assertFileNotExists ($ file );
177+
178+ if (method_exists ($ this , 'assertFileDoesNotExist ' )) {
179+ $ this ->assertFileDoesNotExist ($ file );
180+ } else {
181+ $ this ->assertFileNotExists ($ file );
182+ }
163183 }
164184
165185 /**
0 commit comments