Skip to content

Commit 221c9bb

Browse files
minor symfony#50506 [Filesystem] Fix broken symlink tests Windows PHP 7.4+ (ausi)
This PR was merged into the 5.4 branch. Discussion ---------- [Filesystem] Fix broken symlink tests Windows PHP 7.4+ | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Followup to symfony#50437 | License | MIT | Doc PR | - The test currently fail on windows with PHP >= 7.4 ``` 1) Symfony\Component\Filesystem\Tests\FilesystemTest::testReadBrokenLink Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'C:\…\Temp\1685536465.4767.1091468882/file' +'C:\…\Temp\1685536465.4767.1091468882\file' C:\…\src\Symfony\Component\Filesystem\Tests\FilesystemTest.php:1105 ``` Commits ------- d98a011 Fix broken symlink tests Windows PHP 7.4+
2 parents 5f213ed + d98a011 commit 221c9bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
1515
use Symfony\Component\Filesystem\Exception\IOException;
16+
use Symfony\Component\Filesystem\Path;
1617

1718
/**
1819
* Test class for Filesystem.
@@ -1095,18 +1096,18 @@ public function testReadBrokenLink()
10951096
$this->markTestSkipped('Windows does not support reading "broken" symlinks in PHP < 7.4.0');
10961097
}
10971098

1098-
$file = $this->workspace.'/file';
1099-
$link = $this->workspace.'/link';
1099+
$file = Path::join($this->workspace, 'file');
1100+
$link = Path::join($this->workspace, 'link');
11001101

11011102
touch($file);
11021103
$this->filesystem->symlink($file, $link);
11031104
$this->filesystem->remove($file);
11041105

1105-
$this->assertEquals($file, $this->filesystem->readlink($link));
1106+
$this->assertEquals($file, Path::normalize($this->filesystem->readlink($link)));
11061107
$this->assertNull($this->filesystem->readlink($link, true));
11071108

11081109
touch($file);
1109-
$this->assertEquals($file, $this->filesystem->readlink($link, true));
1110+
$this->assertEquals($file, Path::normalize($this->filesystem->readlink($link, true)));
11101111
}
11111112

11121113
public function testReadLinkDefaultPathDoesNotExist()

0 commit comments

Comments
 (0)