Skip to content

Commit 285ce50

Browse files
Merge branch '2.8' into 3.4
* 2.8: [Filesystem] Add test to prevent regression when using array|resource with dumpFile
2 parents a59f917 + 0b252f4 commit 285ce50

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Tests/FilesystemTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,31 @@ public function testDumpFile()
14831483
}
14841484
}
14851485

1486+
public function testDumpFileWithArray()
1487+
{
1488+
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
1489+
1490+
$this->filesystem->dumpFile($filename, array('bar'));
1491+
1492+
$this->assertFileExists($filename);
1493+
$this->assertStringEqualsFile($filename, 'bar');
1494+
}
1495+
1496+
public function testDumpFileWithResource()
1497+
{
1498+
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
1499+
1500+
$resource = fopen('php://memory', 'rw');
1501+
fwrite($resource, 'bar');
1502+
fseek($resource, 0);
1503+
1504+
$this->filesystem->dumpFile($filename, $resource);
1505+
1506+
fclose($resource);
1507+
$this->assertFileExists($filename);
1508+
$this->assertStringEqualsFile($filename, 'bar');
1509+
}
1510+
14861511
public function testDumpFileOverwritesAnExistingFile()
14871512
{
14881513
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo.txt';

0 commit comments

Comments
 (0)