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
-------

db1c21c8ae [Filesystem] Add test to prevent regression when using array|resource with dumpFile
This commit is contained in:
Nicolas Grekas 2018-08-10 08:52:30 +02:00
commit 30b24d200b
1 changed files with 25 additions and 0 deletions

View File

@ -1201,6 +1201,31 @@ class FilesystemTest extends FilesystemTestCase
$this->assertStringEqualsFile($filename, 'bar');
}
public function testDumpFileWithArray()
{
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
$this->filesystem->dumpFile($filename, array('bar'));
$this->assertFileExists($filename);
$this->assertStringEqualsFile($filename, 'bar');
}
public function testDumpFileWithResource()
{
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
$resource = fopen('php://memory', 'rw');
fwrite($resource, 'bar');
fseek($resource, 0);
$this->filesystem->dumpFile($filename, $resource);
fclose($resource);
$this->assertFileExists($filename);
$this->assertStringEqualsFile($filename, 'bar');
}
/**
* @group legacy
*/