@@ -1087,14 +1087,12 @@ public function testReadBrokenLink()
10871087 {
10881088 $ this ->markAsSkippedIfSymlinkIsMissing ();
10891089
1090- if ('\\' === \DIRECTORY_SEPARATOR ) {
1091- $ this ->markTestSkipped ('Windows does not support creating "broken" symlinks ' );
1092- }
1093-
10941090 $ file = $ this ->workspace .'/file ' ;
10951091 $ link = $ this ->workspace .'/link ' ;
10961092
1093+ touch ($ file );
10971094 $ this ->filesystem ->symlink ($ file , $ link );
1095+ $ this ->filesystem ->remove ($ file );
10981096
10991097 $ this ->assertEquals ($ file , $ this ->filesystem ->readlink ($ link ));
11001098 $ this ->assertNull ($ this ->filesystem ->readlink ($ link , true ));
@@ -1601,6 +1599,33 @@ public function testDumpFileOverwritesAnExistingFile()
16011599 $ this ->assertStringEqualsFile ($ filename , 'bar ' );
16021600 }
16031601
1602+ public function testDumpFileFollowsSymlink ()
1603+ {
1604+ $ filename = $ this ->workspace .\DIRECTORY_SEPARATOR .'foo.txt ' ;
1605+ file_put_contents ($ filename , 'FOO BAR ' );
1606+ $ linknameA = $ this ->workspace .\DIRECTORY_SEPARATOR .'bar.txt ' ;
1607+ $ linknameB = $ this ->workspace .\DIRECTORY_SEPARATOR .'baz.txt ' ;
1608+ $ this ->filesystem ->symlink ($ filename , $ linknameA );
1609+ $ this ->filesystem ->symlink ($ linknameA , $ linknameB );
1610+
1611+ $ this ->filesystem ->dumpFile ($ linknameB , 'bar ' );
1612+
1613+ $ this ->assertFileExists ($ filename );
1614+ $ this ->assertFileExists ($ linknameA );
1615+ $ this ->assertFileExists ($ linknameB );
1616+ $ this ->assertStringEqualsFile ($ filename , 'bar ' );
1617+ $ this ->assertStringEqualsFile ($ linknameA , 'bar ' );
1618+ $ this ->assertStringEqualsFile ($ linknameB , 'bar ' );
1619+
1620+ $ this ->filesystem ->remove ($ filename );
1621+ $ this ->filesystem ->dumpFile ($ linknameB , 'baz ' );
1622+
1623+ $ this ->assertFileExists ($ filename );
1624+ $ this ->assertStringEqualsFile ($ filename , 'baz ' );
1625+ $ this ->assertStringEqualsFile ($ linknameA , 'baz ' );
1626+ $ this ->assertStringEqualsFile ($ linknameB , 'baz ' );
1627+ }
1628+
16041629 public function testDumpFileWithFileScheme ()
16051630 {
16061631 $ scheme = 'file:// ' ;
@@ -1674,6 +1699,35 @@ public function testAppendToFileWithResource()
16741699 }
16751700 }
16761701
1702+ public function testAppendToFileFollowsSymlink ()
1703+ {
1704+ $ filename = $ this ->workspace .\DIRECTORY_SEPARATOR .'foo.txt ' ;
1705+ file_put_contents ($ filename , 'foo ' );
1706+ $ linknameA = $ this ->workspace .\DIRECTORY_SEPARATOR .'bar.txt ' ;
1707+ $ linknameB = $ this ->workspace .\DIRECTORY_SEPARATOR .'baz.txt ' ;
1708+ $ this ->filesystem ->symlink ($ filename , $ linknameA );
1709+ $ this ->filesystem ->symlink ($ linknameA , $ linknameB );
1710+
1711+ $ this ->filesystem ->appendToFile ($ linknameA , 'bar ' );
1712+ $ this ->filesystem ->appendToFile ($ linknameB , 'baz ' );
1713+
1714+ $ this ->assertFileExists ($ filename );
1715+ $ this ->assertFileExists ($ linknameA );
1716+ $ this ->assertFileExists ($ linknameB );
1717+ $ this ->assertStringEqualsFile ($ filename , 'foobarbaz ' );
1718+ $ this ->assertStringEqualsFile ($ linknameA , 'foobarbaz ' );
1719+ $ this ->assertStringEqualsFile ($ linknameB , 'foobarbaz ' );
1720+
1721+ $ this ->filesystem ->remove ($ filename );
1722+ $ this ->filesystem ->appendToFile ($ linknameB , 'foo ' );
1723+ $ this ->filesystem ->appendToFile ($ linknameA , 'bar ' );
1724+
1725+ $ this ->assertFileExists ($ filename );
1726+ $ this ->assertStringEqualsFile ($ filename , 'foobar ' );
1727+ $ this ->assertStringEqualsFile ($ linknameA , 'foobar ' );
1728+ $ this ->assertStringEqualsFile ($ linknameB , 'foobar ' );
1729+ }
1730+
16771731 public function testAppendToFileWithScheme ()
16781732 {
16791733 $ scheme = 'file:// ' ;
0 commit comments