@@ -1087,14 +1087,12 @@ public function testReadBrokenLink()
1087
1087
{
1088
1088
$ this ->markAsSkippedIfSymlinkIsMissing ();
1089
1089
1090
- if ('\\' === \DIRECTORY_SEPARATOR ) {
1091
- $ this ->markTestSkipped ('Windows does not support creating "broken" symlinks ' );
1092
- }
1093
-
1094
1090
$ file = $ this ->workspace .'/file ' ;
1095
1091
$ link = $ this ->workspace .'/link ' ;
1096
1092
1093
+ touch ($ file );
1097
1094
$ this ->filesystem ->symlink ($ file , $ link );
1095
+ $ this ->filesystem ->remove ($ file );
1098
1096
1099
1097
$ this ->assertEquals ($ file , $ this ->filesystem ->readlink ($ link ));
1100
1098
$ this ->assertNull ($ this ->filesystem ->readlink ($ link , true ));
@@ -1601,6 +1599,33 @@ public function testDumpFileOverwritesAnExistingFile()
1601
1599
$ this ->assertStringEqualsFile ($ filename , 'bar ' );
1602
1600
}
1603
1601
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
+
1604
1629
public function testDumpFileWithFileScheme ()
1605
1630
{
1606
1631
$ scheme = 'file:// ' ;
@@ -1674,6 +1699,35 @@ public function testAppendToFileWithResource()
1674
1699
}
1675
1700
}
1676
1701
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
+
1677
1731
public function testAppendToFileWithScheme ()
1678
1732
{
1679
1733
$ scheme = 'file:// ' ;
0 commit comments