diff options
Diffstat (limited to 'tests/lib/files/view.php')
-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')); + } } |