mirror of
https://github.com/adlawson/php-vfs.git
synced 2024-11-25 06:07:40 +00:00
6854d33591
Also includes tests for `file_put_contents`.
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
namespace Vfs\Stream\StreamWrapper;
|
|
|
|
use Vfs\Test\AcceptanceTestCase;
|
|
|
|
class FileGetContentsAcceptanceTest extends AcceptanceTestCase
|
|
{
|
|
protected $tree = [
|
|
'foo' => [
|
|
'bar' => 'baz'
|
|
]
|
|
];
|
|
|
|
public function testGetFile()
|
|
{
|
|
$this->assertEquals($this->tree['foo']['bar'], file_get_contents("$this->scheme://foo/bar"));
|
|
}
|
|
|
|
public function testPutFile()
|
|
{
|
|
file_put_contents("$this->scheme://foo/bar", 'bar');
|
|
|
|
$this->assertEquals('bar', $this->fs->get('/foo/bar')->getContent());
|
|
}
|
|
|
|
public function testPutExistingFile()
|
|
{
|
|
file_put_contents("$this->scheme://foo/bar", '_updated');
|
|
|
|
$this->assertEquals('_updated', $this->fs->get('/foo/bar')->getContent());
|
|
}
|
|
|
|
public function testPutAppendExistingFile()
|
|
{
|
|
file_put_contents("$this->scheme://foo/bar", '_updated', FILE_APPEND);
|
|
|
|
$this->assertEquals($this->tree['foo']['bar'] . '_updated', $this->fs->get('/foo/bar')->getContent());
|
|
}
|
|
}
|