Skip to content

Commit b9fec0e

Browse files
committed
Fixed tests on windows
1 parent 0d2e33f commit b9fec0e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

tests/Gitonomy/Git/Tests/AbstractTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ public static function deleteDir($dir)
109109
$iterator = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS);
110110
$iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
111111
foreach ($iterator as $file) {
112+
chmod($file, 0777);
112113
if (is_dir($file)) {
113114
rmdir($file);
114115
} else {
115116
unlink($file);
116117
}
117118
}
118119

120+
chmod($dir, 0777);
119121
rmdir($dir);
120122
}
121123

tests/Gitonomy/Git/Tests/HooksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function testSet($repository)
131131
$this->assertEquals('bar', file_get_contents($file), 'Hook content is correct');
132132

133133
$perms = fileperms($file);
134-
$this->assertEquals(0777, $perms & 0777, "Hook permissions are correct");
134+
$this->assertEquals(defined('PHP_WINDOWS_VERSION_BUILD') ? 0666 : 0777, $perms & 0777, "Hook permissions are correct");
135135
}
136136

137137
/**

tests/Gitonomy/Git/Tests/RepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testGetBlob_WithExisting_Works($repository)
3434
public function testGetSize($repository)
3535
{
3636
$size = $repository->getSize();
37-
$this->assertGreaterThan(100, $size, "Repository is greater than 100KB");
37+
$this->assertGreaterThan(70, $size, "Repository is greater than 70KB");
3838
}
3939

4040
public function testIsBare()

tests/bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
require __DIR__.'/../vendor/autoload.php';
33

44
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
5-
$server = array_change_key_case($_SERVER);
5+
$server = array_change_key_case($_SERVER, true);
66
$_SERVER['GIT_ENVS'] = array();
77
foreach (array('PATH', 'SYSTEMROOT') as $key) {
8-
if (isset($server[strtolower($key)])) {
9-
$_SERVER['GIT_ENVS'][strtoupper($key)] = $server[strtolower($key)];
8+
if (isset($server[$key])) {
9+
$_SERVER['GIT_ENVS'][$key] = $server[$key];
1010
}
1111
}
1212
unset($server);

0 commit comments

Comments
 (0)