1
0
Fork 0

Merge pull request #3854 from hakre/fix/symlink-missing

Prevent fatal error on missing symlink() function in tests
pull/3899/merge
Jordi Boggiano 2015-04-15 02:43:13 +01:00
commit 46924cf5f5
1 changed files with 9 additions and 0 deletions

View File

@ -188,6 +188,7 @@ class FilesystemTest extends TestCase
@mkdir($basepath . "/real", 0777, true);
touch($basepath . "/real/FILE");
$this->skipTestIfSymlinkPhpFunctionIsMissing();
$result = @symlink($basepath . "/real", $symlinked);
if (!$result) {
@ -216,6 +217,7 @@ class FilesystemTest extends TestCase
$symlinked = $basepath . "/linked";
$symlinkedTrailingSlash = $symlinked . "/";
$this->skipTestIfSymlinkPhpFunctionIsMissing();
$result = @symlink($basepath . "/real", $symlinked);
if (!$result) {
@ -237,4 +239,11 @@ class FilesystemTest extends TestCase
$this->assertFalse(file_exists($symlinkedTrailingSlash));
$this->assertFalse(file_exists($symlinked));
}
private function skipTestIfSymlinkPhpFunctionIsMissing()
{
if (!function_exists('symlink')) {
$this->markTestSkipped('The php symlink() function for symbolic links is not available on this platform');
}
}
}