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:
commit
30b24d200b
|
@ -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
|
||||
*/
|
||||
|
|
Reference in New Issue