@@ -1334,21 +1334,21 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
13341334
13351335 public function testMirrorWithCustomIterator ()
13361336 {
1337- $ sourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1337+ $ sourcePath = $ this ->workspace .\ DIRECTORY_SEPARATOR .'source ' .\ DIRECTORY_SEPARATOR ;
13381338 mkdir ($ sourcePath );
13391339
1340- $ file = $ sourcePath .DIRECTORY_SEPARATOR .'file ' ;
1340+ $ file = $ sourcePath .\ DIRECTORY_SEPARATOR .'file ' ;
13411341 file_put_contents ($ file , 'FILE ' );
13421342
1343- $ targetPath = $ this ->workspace .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR ;
1343+ $ targetPath = $ this ->workspace .\ DIRECTORY_SEPARATOR .'target ' .\ DIRECTORY_SEPARATOR ;
13441344
13451345 $ splFile = new \SplFileInfo ($ file );
13461346 $ iterator = new \ArrayObject (array ($ splFile ));
13471347
13481348 $ this ->filesystem ->mirror ($ sourcePath , $ targetPath , $ iterator );
13491349
13501350 $ this ->assertTrue (is_dir ($ targetPath ));
1351- $ this ->assertFileEquals ($ file , $ targetPath .DIRECTORY_SEPARATOR .'file ' );
1351+ $ this ->assertFileEquals ($ file , $ targetPath .\ DIRECTORY_SEPARATOR .'file ' );
13521352 }
13531353
13541354 /**
@@ -1357,14 +1357,14 @@ public function testMirrorWithCustomIterator()
13571357 */
13581358 public function testMirrorWithCustomIteratorWithRelativePath ()
13591359 {
1360- $ sourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR .'.. ' .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1361- $ realSourcePath = $ this ->workspace .DIRECTORY_SEPARATOR .'source ' .DIRECTORY_SEPARATOR ;
1360+ $ sourcePath = $ this ->workspace .\ DIRECTORY_SEPARATOR .'source ' .\ DIRECTORY_SEPARATOR .'.. ' .\ DIRECTORY_SEPARATOR .'source ' .\ DIRECTORY_SEPARATOR ;
1361+ $ realSourcePath = $ this ->workspace .\ DIRECTORY_SEPARATOR .'source ' .\ DIRECTORY_SEPARATOR ;
13621362 mkdir ($ realSourcePath );
13631363
13641364 $ file = $ realSourcePath .'file ' ;
13651365 file_put_contents ($ file , 'FILE ' );
13661366
1367- $ targetPath = $ this ->workspace .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR .'.. ' .DIRECTORY_SEPARATOR .'target ' .DIRECTORY_SEPARATOR ;
1367+ $ targetPath = $ this ->workspace .\ DIRECTORY_SEPARATOR .'target ' .\ DIRECTORY_SEPARATOR .'.. ' .\ DIRECTORY_SEPARATOR .'target ' .\ DIRECTORY_SEPARATOR ;
13681368
13691369 $ splFile = new \SplFileInfo ($ file );
13701370 $ iterator = new \ArrayObject (array ($ splFile ));
@@ -1518,6 +1518,10 @@ public function testDumpFile()
15181518 }
15191519 }
15201520
1521+ /**
1522+ * @group legacy
1523+ * @expectedDeprecation Calling "Symfony\Component\Filesystem\Filesystem::dumpFile()" with an array in the $content argument is deprecated since Symfony 4.3.
1524+ */
15211525 public function testDumpFileWithArray ()
15221526 {
15231527 $ filename = $ this ->workspace .\DIRECTORY_SEPARATOR .'foo ' .\DIRECTORY_SEPARATOR .'baz.txt ' ;
@@ -1600,6 +1604,60 @@ public function testAppendToFile()
16001604 }
16011605 }
16021606
1607+ /**
1608+ * @group legacy
1609+ * @expectedDeprecation Calling "Symfony\Component\Filesystem\Filesystem::appendToFile()" with an array in the $content argument is deprecated since Symfony 4.3.
1610+ */
1611+ public function testAppendToFileWithArray ()
1612+ {
1613+ $ filename = $ this ->workspace .\DIRECTORY_SEPARATOR .'foo ' .\DIRECTORY_SEPARATOR .'bar.txt ' ;
1614+
1615+ // skip mode check on Windows
1616+ if ('\\' !== \DIRECTORY_SEPARATOR ) {
1617+ $ oldMask = umask (0002 );
1618+ }
1619+
1620+ $ this ->filesystem ->dumpFile ($ filename , 'foo ' );
1621+
1622+ $ this ->filesystem ->appendToFile ($ filename , array ('bar ' ));
1623+
1624+ $ this ->assertFileExists ($ filename );
1625+ $ this ->assertStringEqualsFile ($ filename , 'foobar ' );
1626+
1627+ // skip mode check on Windows
1628+ if ('\\' !== \DIRECTORY_SEPARATOR ) {
1629+ $ this ->assertFilePermissions (664 , $ filename );
1630+ umask ($ oldMask );
1631+ }
1632+ }
1633+
1634+ public function testAppendToFileWithResource ()
1635+ {
1636+ $ filename = $ this ->workspace .\DIRECTORY_SEPARATOR .'foo ' .\DIRECTORY_SEPARATOR .'bar.txt ' ;
1637+
1638+ // skip mode check on Windows
1639+ if ('\\' !== \DIRECTORY_SEPARATOR ) {
1640+ $ oldMask = umask (0002 );
1641+ }
1642+
1643+ $ this ->filesystem ->dumpFile ($ filename , 'foo ' );
1644+
1645+ $ resource = fopen ('php://memory ' , 'rw ' );
1646+ fwrite ($ resource , 'bar ' );
1647+ fseek ($ resource , 0 );
1648+
1649+ $ this ->filesystem ->appendToFile ($ filename , $ resource );
1650+
1651+ $ this ->assertFileExists ($ filename );
1652+ $ this ->assertStringEqualsFile ($ filename , 'foobar ' );
1653+
1654+ // skip mode check on Windows
1655+ if ('\\' !== \DIRECTORY_SEPARATOR ) {
1656+ $ this ->assertFilePermissions (664 , $ filename );
1657+ umask ($ oldMask );
1658+ }
1659+ }
1660+
16031661 public function testAppendToFileWithScheme ()
16041662 {
16051663 $ scheme = 'file:// ' ;
0 commit comments