diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-01-20 12:59:57 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-01-29 15:39:56 +0100 |
commit | 2124540d1d9f500423e5149b1490ed489788ff1d (patch) | |
tree | 4fc91496246e020c477557e1e4133e689cb59c29 /tests | |
parent | 65ec950b27d625b8184fbff28ecb7778f55415d9 (diff) | |
download | nextcloud-server-2124540d1d9f500423e5149b1490ed489788ff1d.tar.gz nextcloud-server-2124540d1d9f500423e5149b1490ed489788ff1d.zip |
Dont remove a file from cache if the delete operation failed
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/view.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 5e42e5ffd0f..9ddc9c80475 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -849,4 +849,27 @@ class View extends \Test\TestCase { $this->assertEquals($time, $view->filemtime('/test/sub/storage/foo/bar.txt')); } + + public function testDeleteFailKeepCache() { + /** + * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Storage\Temporary $storage + */ + $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') + ->setConstructorArgs(array(array())) + ->setMethods(array('unlink')) + ->getMock(); + $storage->expects($this->once()) + ->method('unlink') + ->will($this->returnValue(false)); + $scanner = $storage->getScanner(); + $cache = $storage->getCache(); + $storage->file_put_contents('foo.txt', 'asd'); + $scanner->scan(''); + \OC\Files\Filesystem::mount($storage, array(), '/test/'); + + $view = new \OC\Files\View('/test'); + + $this->assertFalse($view->unlink('foo.txt')); + $this->assertTrue($cache->inCache('foo.txt')); + } } |