From e102eec89a51af807c1802fb8e382b68e999ebe8 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 26 Nov 2013 12:47:00 +0100 Subject: [PATCH 1/2] Return true when touch succeeds --- apps/files_external/lib/streamwrapper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index 23c5f91a2f..aa42cbde82 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -68,6 +68,7 @@ abstract class StreamWrapper extends Common { } } else { $this->file_put_contents($path, ''); + return true; } } From 712b47757af04d6c62fd8da222aa197c23363678 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 26 Nov 2013 12:53:03 +0100 Subject: [PATCH 2/2] Updated unit tests for SMB - coverage for touch return value - fixed directory provider to exclude unsupported cases --- apps/files_external/tests/smb.php | 5 +++++ tests/lib/files/storage/storage.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/files_external/tests/smb.php b/apps/files_external/tests/smb.php index 0291f293fa..199e35af67 100644 --- a/apps/files_external/tests/smb.php +++ b/apps/files_external/tests/smb.php @@ -29,6 +29,11 @@ class SMB extends Storage { } } + public function directoryProvider() { + // doesn't support leading/trailing spaces + return array(array('folder')); + } + public function testRenameWithSpaces() { $this->instance->mkdir('with spaces'); $result = $this->instance->rename('with spaces', 'foo bar'); diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index 6c433e9547..5b5b855685 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -236,7 +236,8 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { public function testTouchCreateFile() { $this->assertFalse($this->instance->file_exists('foo')); - $this->instance->touch('foo'); + // returns true on success + $this->assertTrue($this->instance->touch('foo')); $this->assertTrue($this->instance->file_exists('foo')); }