|
|
|
@ -34,6 +34,7 @@ use Sabre\HTTP\ResponseInterface; |
|
|
|
|
use Test\TestCase; |
|
|
|
|
use OCA\DAV\Upload\FutureFile; |
|
|
|
|
use OCA\DAV\Connector\Sabre\Directory; |
|
|
|
|
use OCP\Files\FileInfo; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Copyright (c) 2015 Vincent Petry <pvince81@owncloud.com> |
|
|
|
@ -148,13 +149,15 @@ class FilesPluginTest extends TestCase { |
|
|
|
|
$node->expects($this->any()) |
|
|
|
|
->method('getDavPermissions') |
|
|
|
|
->will($this->returnValue('DWCKMSR')); |
|
|
|
|
|
|
|
|
|
$fileInfo = $this->createMock(FileInfo::class); |
|
|
|
|
$fileInfo->expects($this->any()) |
|
|
|
|
->method('isReadable') |
|
|
|
|
->willReturn(true); |
|
|
|
|
|
|
|
|
|
$node->expects($this->any()) |
|
|
|
|
->method('getFileInfo') |
|
|
|
|
->will($this->returnValue( |
|
|
|
|
$this->getMockBuilder('\OCP\Files\FileInfo') |
|
|
|
|
->disableOriginalConstructor() |
|
|
|
|
->getMock() |
|
|
|
|
)); |
|
|
|
|
->willReturn($fileInfo); |
|
|
|
|
|
|
|
|
|
return $node; |
|
|
|
|
} |
|
|
|
@ -313,6 +316,15 @@ class FilesPluginTest extends TestCase { |
|
|
|
|
->getMock(); |
|
|
|
|
$node->expects($this->any())->method('getPath')->willReturn('/'); |
|
|
|
|
|
|
|
|
|
$fileInfo = $this->createMock(FileInfo::class); |
|
|
|
|
$fileInfo->expects($this->any()) |
|
|
|
|
->method('isReadable') |
|
|
|
|
->willReturn(true); |
|
|
|
|
|
|
|
|
|
$node->expects($this->any()) |
|
|
|
|
->method('getFileInfo') |
|
|
|
|
->willReturn($fileInfo); |
|
|
|
|
|
|
|
|
|
$propFind = new PropFind( |
|
|
|
|
'/', |
|
|
|
|
[ |
|
|
|
@ -329,6 +341,39 @@ class FilesPluginTest extends TestCase { |
|
|
|
|
$this->assertEquals('my_fingerprint', $propFind->get(self::DATA_FINGERPRINT_PROPERTYNAME)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @expectedException \Sabre\DAV\Exception\NotFound |
|
|
|
|
*/ |
|
|
|
|
public function testGetPropertiesWhenNoPermission() { |
|
|
|
|
/** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit_Framework_MockObject_MockObject $node */ |
|
|
|
|
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory') |
|
|
|
|
->disableOriginalConstructor() |
|
|
|
|
->getMock(); |
|
|
|
|
$node->expects($this->any())->method('getPath')->willReturn('/'); |
|
|
|
|
|
|
|
|
|
$fileInfo = $this->createMock(FileInfo::class); |
|
|
|
|
$fileInfo->expects($this->any()) |
|
|
|
|
->method('isReadable') |
|
|
|
|
->willReturn(false); |
|
|
|
|
|
|
|
|
|
$node->expects($this->any()) |
|
|
|
|
->method('getFileInfo') |
|
|
|
|
->willReturn($fileInfo); |
|
|
|
|
|
|
|
|
|
$propFind = new PropFind( |
|
|
|
|
'/test', |
|
|
|
|
[ |
|
|
|
|
self::DATA_FINGERPRINT_PROPERTYNAME, |
|
|
|
|
], |
|
|
|
|
0 |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->plugin->handleGetProperties( |
|
|
|
|
$propFind, |
|
|
|
|
$node |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUpdateProps() { |
|
|
|
|
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); |
|
|
|
|
|
|
|
|
|