8000 Fix tests on Windows · symfony/symfony@d729da4 · GitHub
[go: up one dir, main page]

Skip to content

Commit d729da4

Browse files
committed
Fix tests on Windows
1 parent 48a66c1 commit d729da4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,14 +1091,16 @@ public function testReadBrokenLink()
10911091
{
10921092
$this->markAsSkippedIfSymlinkIsMissing();
10931093

1094-
if ('\\' === \DIRECTORY_SEPARATOR) {
1095-
$this->markTestSkipped('Windows does not support creating "broken" symlinks');
1094+
if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
1095+
$this->markTestSkipped('Windows does not support reading "broken" symlinks in PHP < 7.4.0');
10961096
}
10971097

10981098
$file = $this->workspace.'/file';
10991099
$link = $this->workspace.'/link';
11001100

1101+
touch($file);
11011102
$this->filesystem->symlink($file, $link);
1103+
$this->filesystem->remove($file);
11021104

11031105
$this->assertEquals($file, $this->filesystem->readlink($link));
11041106
$this->assertNull($this->filesystem->readlink($link, true));
@@ -1623,6 +1625,11 @@ public function testDumpFileFollowsSymlink()
16231625
$this->assertStringEqualsFile($linknameA, 'bar');
16241626
$this->assertStringEqualsFile($linknameB, 'bar');
16251627

1628+
// Windows does not support reading "broken" symlinks in PHP < 7.4.0
1629+
if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
1630+
return;
1631+
}
1632+
16261633
$this->filesystem->remove($filename);
16271634
$this->filesystem->dumpFile($linknameB, 'baz');
16281635

0 commit comments

Comments
 (0)
0