@@ -19,7 +19,10 @@ class HooksTest extends AbstractTest
19
19
{
20
20
private static $ symlinkOnWindows = null ;
21
21
22
- public static function setUpBeforeClass ()
22
+ /**
23
+ * @beforeClass
24
+ */
25
+ public static function setUpWindows ()
23
26
{
24
27
if (defined ('PHP_WINDOWS_VERSION_MAJOR ' )) {
25
28
self ::$ symlinkOnWindows = true ;
@@ -52,6 +55,7 @@ public function assertHasHook($repository, $hook)
52
55
$ file = $ this ->hookPath ($ repository , $ hook );
53
56
54
57
$ this ->assertTrue ($ repository ->getHooks ()->has ($ hook ), "hook $ hook in repository " );
58
+
55
59
$ this ->assertFileExists ($ file , "Hook $ hook is present " );
56
60
}
57
61
@@ -60,7 +64,12 @@ public function assertNoHook($repository, $hook)
60
64
$ file = $ this ->hookPath ($ repository , $ hook );
61
65
62
66
$ 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
+ }
64
73
}
65
74
66
75
/**
@@ -104,7 +113,12 @@ public function testSymlink($repository)
104
113
$ repository ->getHooks ()->setSymlink ('foo ' , $ file );
105
114
106
115
$ 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
+ );
108
122
}
109
123
110
124
/**
@@ -147,6 +161,7 @@ public function testSet_Existing_ThrowsLogicException($repository)
147
161
$ repository ->getHooks ()->set ('foo ' , 'bar ' );
148
162
149
163
$ this ->expectException (LogicException::class);
164
+
150
165
$ repository ->getHooks ()->set ('foo ' , 'bar ' );
151
166
}
152
167
@@ -159,7 +174,12 @@ public function testRemove($repository)
159
174
touch ($ file );
160
175
161
176
$ 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
+ }
163
183
}
164
184
165
185
/**
0 commit comments