diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-11-14 21:39:39 +0400 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-11-19 18:05:11 +0400 |
commit | 5b6d1d79d06e404ce4a52f75393a98f52769da48 (patch) | |
tree | d9e08530b8d4885a5ee9ac9af3891ba75e563da6 /tests | |
parent | 8ab40f195984e76ec1fe8e89c8f0081f6bb7a418 (diff) |
Fixed SMB file deletion success detection
Since unlink() smb4php doesn't return true on deletion success, we need
to check whether the file was deleted to confirm success.
Fixes #5866
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/storage.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index f72a5276db5..6c433e95475 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -182,8 +182,9 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertTrue($this->instance->hasUpdated('/lorem.txt', $ctimeStart - 5)); $this->assertTrue($this->instance->hasUpdated('/', $ctimeStart - 5)); - $this->assertTrue(($ctimeStart - 5) <= $mTime); - $this->assertTrue($mTime <= ($ctimeEnd + 1)); + // check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1) + $this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime); + $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime); $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt')); $stat = $this->instance->stat('/lorem.txt'); @@ -202,6 +203,17 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertTrue($this->instance->hasUpdated('/', $mtimeStart - 5)); } + public function testUnlink() { + $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; + $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); + + $this->assertTrue($this->instance->file_exists('/lorem.txt')); + + $this->assertTrue($this->instance->unlink('/lorem.txt')); + + $this->assertFalse($this->instance->file_exists('/lorem.txt')); + } + public function testFOpen() { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |