Skip to content

Commit 025f761

Browse files
committed
minor #16986 Fix Filesystem tests on Windows (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Fix Filesystem tests on Windows | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16985 | License | MIT | Doc PR | - PHP's symlink function doesn't support relative symlinks on Windows. Running the filesystem tests in Windows resulted in 2 erroring tests because of this. After this PR, these tests are skipped on Windows. The error wasn't catched by appveyor, as appveyor doesn't support symlinks at all. Commits ------- c376cf3 Fix FileSystem tests on Windows
2 parents 89e8619 + c376cf3 commit 025f761

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ public function testMirrorCopiesLinks()
884884

885885
public function testMirrorCopiesLinkedDirectoryContents()
886886
{
887-
$this->markAsSkippedIfSymlinkIsMissing();
887+
$this->markAsSkippedIfSymlinkIsMissing(true);
888888

889889
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
890890

@@ -904,7 +904,7 @@ public function testMirrorCopiesLinkedDirectoryContents()
904904

905905
public function testMirrorCopiesRelativeLinkedContents()
906906
{
907-
$this->markAsSkippedIfSymlinkIsMissing();
907+
$this->markAsSkippedIfSymlinkIsMissing(true);
908908

909909
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
910910
$oldPath = getcwd();
@@ -1028,7 +1028,10 @@ private function getFileGroup($filepath)
10281028
$this->markTestSkipped('Unable to retrieve file group name');
10291029
}
10301030

1031-
private function markAsSkippedIfSymlinkIsMissing()
1031+
/**
1032+
* @param bool $relative Whether support for relative symlinks is required
1033+
*/
1034+
private function markAsSkippedIfSymlinkIsMissing($relative = false)
10321035
{
10331036
if (!function_exists('symlink')) {
10341037
$this->markTestSkipped('symlink is not supported');
@@ -1037,6 +1040,11 @@ private function markAsSkippedIfSymlinkIsMissing()
10371040
if (false === self::$symlinkOnWindows) {
10381041
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
10391042
}
1043+
1044+
// https://bugs.php.net/bug.php?id=69473
1045+
if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
1046+
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
1047+
}
10401048
}
10411049

10421050
private function markAsSkippedIfChmodIsMissing()

0 commit comments

Comments
 (0)