diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-11-14 18:39:39 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-11-15 16:36:45 +0100 |
commit | 79929fb6fae506276e957f289a8c58640ed7ff1d (patch) | |
tree | 795ce96bc260b13ad74491e42f3aa6a215d4c000 /tests/lib | |
parent | 321a1062d196d2ad150a012ff00496f9c69c38d4 (diff) | |
download | nextcloud-server-79929fb6fae506276e957f289a8c58640ed7ff1d.tar.gz nextcloud-server-79929fb6fae506276e957f289a8c58640ed7ff1d.zip |
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
Backport of eefd91355d54b7e49dd328cef9a9561ee51b0194
Diffstat (limited to 'tests/lib')
-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 4089853f02f..4587a3b2d06 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 - 1)); $this->assertTrue($this->instance->hasUpdated('/', $ctimeStart - 1)); - $this->assertTrue(($ctimeStart - 1) <= $mTime); - $this->assertTrue($mTime <= ($ctimeEnd + 1)); + // check that ($ctimeStart - 1) <= $mTime <= ($ctimeEnd + 1) + $this->assertGreaterThanOrEqual(($ctimeStart - 1), $mTime); + $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime); $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt')); $stat = $this->instance->stat('/lorem.txt'); @@ -249,6 +250,17 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertContains('/sub/logo-wide.png', $result); } + 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'; |