diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-07-20 20:56:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 20:56:59 +0200 |
commit | e08278494d0ccc785065dfb6666e2e67e4cda705 (patch) | |
tree | d96ea941074eeda5d557d01fc411aa9b0e8dbd91 /tests | |
parent | 1088916edaf5166e5dd4cf57a796ddb38b9c1477 (diff) | |
parent | 631af42b3afdbea58e49cb85685cc8951f6375b4 (diff) | |
download | nextcloud-server-e08278494d0ccc785065dfb6666e2e67e4cda705.tar.gz nextcloud-server-e08278494d0ccc785065dfb6666e2e67e4cda705.zip |
Merge pull request #471 from nextcloud/storage-fopenspecialchars
Added storage tests for fopen with special chars
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Storage/Storage.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index ed2ea87f9d9..04aafece2e3 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -105,6 +105,17 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals(array(), $content); } + public function fileNameProvider() { + return [ + ['file.txt'], + [' file.txt'], + ['folder .txt'], + ['file with space.txt'], + ['spéciäl fäile'], + ['test single\'quote.txt'], + ]; + } + public function directoryProvider() { return [ ['folder'], @@ -336,22 +347,25 @@ abstract class Storage extends \Test\TestCase { $this->assertFalse($this->instance->file_exists('/lorem.txt')); } - public function testFOpen() { + /** + * @dataProvider fileNameProvider + */ + public function testFOpen($fileName) { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; - $fh = @$this->instance->fopen('foo', 'r'); + $fh = @$this->instance->fopen($fileName, 'r'); if ($fh) { fclose($fh); } $this->assertFalse($fh); - $this->assertFalse($this->instance->file_exists('foo')); + $this->assertFalse($this->instance->file_exists($fileName)); - $fh = $this->instance->fopen('foo', 'w'); + $fh = $this->instance->fopen($fileName, 'w'); fwrite($fh, file_get_contents($textFile)); fclose($fh); - $this->assertTrue($this->instance->file_exists('foo')); + $this->assertTrue($this->instance->file_exists($fileName)); - $fh = $this->instance->fopen('foo', 'r'); + $fh = $this->instance->fopen($fileName, 'r'); $content = stream_get_contents($fh); $this->assertEquals(file_get_contents($textFile), $content); } |