8000 minor #28019 [Filesystem] Add test to prevent regression when using a… · symfony/symfony@30b24d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 30b24d2

Browse files
minor #28019 [Filesystem] Add test to prevent regression when using array|resource with dumpFile (thePanz)
This PR was merged into the 2.8 branch. Discussion ---------- [Filesystem] Add test to prevent regression when using array|resource with dumpFile | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT Commits ------- db1c21c [Filesystem] Add test to prevent regression when using array|resource with dumpFile
2 parents 74a4cea + db1c21c commit 30b24d2

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