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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy