8000 [Filesystem] Add test to prevent regression when using array|resource… · symfony/symfony@db1c21c · GitHub
[go: up one dir, main page]

Skip to content

Commit db1c21c

Browse files
thePanznicolas-grekas
authored andcommitted
[Filesystem] Add test to prevent regression when using array|resource with dumpFile
1 parent a81d7d9 commit db1c21c

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,31 @@ public function testDumpFile()
12011201
$this->assertStringEqualsFile($filename, 'bar');
12021202
}
12031203

1204+
public function testDumpFileWithArray()
1205+
{
1206+
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
1207+
1208+
$this->filesystem->dumpFile($filename, array('bar'));
1209+
1210+
$this->assertFileExists($filename);
1211+
$this->assertStringEqualsFile($filename, 'bar');
1212+
}
1213+
1214+
public function testDumpFileWithResource()
1215+
{
1216+
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
1217+
1218+
$resource = fopen('php://memory', 'rw');
1219+
fwrite($resource, 'bar');
1220+
fseek($resource, 0);
1221+
1222+
$this->filesystem->dumpFile($filename, $resource);
1223+
1224+
fclose($resource);
1225+
$this->assertFileExists($filename);
1226+
$this->assertStringEqualsFile($filename, 'bar');
1227+
}
1228+
12041229
/**
12051230
* @group legacy
12061231
*/

0 commit comments

Comments
 (0)
0