|
@@ 244-266 (lines=23) @@
|
| 241 |
|
/** |
| 242 |
|
* @expectedException \OC\Connector\Sabre\Exception\InvalidPath |
| 243 |
|
*/ |
| 244 |
|
public function testGetNodeForPathInvalidPath() { |
| 245 |
|
$path = '/foo\bar'; |
| 246 |
|
|
| 247 |
|
|
| 248 |
|
$storage = new Temporary([]); |
| 249 |
|
|
| 250 |
|
$view = $this->getMock('\OC\Files\View', ['resolvePath']); |
| 251 |
|
$view->expects($this->once()) |
| 252 |
|
->method('resolvePath') |
| 253 |
|
->will($this->returnCallback(function($path) use ($storage){ |
| 254 |
|
return [$storage, ltrim($path, '/')]; |
| 255 |
|
})); |
| 256 |
|
|
| 257 |
|
$rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory') |
| 258 |
|
->disableOriginalConstructor() |
| 259 |
|
->getMock(); |
| 260 |
|
$mountManager = $this->getMock('\OC\Files\Mount\Manager'); |
| 261 |
|
|
| 262 |
|
$tree = new \OC\Connector\Sabre\ObjectTree(); |
| 263 |
|
$tree->init($rootNode, $view, $mountManager); |
| 264 |
|
|
| 265 |
|
$tree->getNodeForPath($path); |
| 266 |
|
} |
| 267 |
|
|
| 268 |
|
public function testGetNodeForPathRoot() { |
| 269 |
|
$path = '/'; |
|
@@ 268-290 (lines=23) @@
|
| 265 |
|
$tree->getNodeForPath($path); |
| 266 |
|
} |
| 267 |
|
|
| 268 |
|
public function testGetNodeForPathRoot() { |
| 269 |
|
$path = '/'; |
| 270 |
|
|
| 271 |
|
|
| 272 |
|
$storage = new Temporary([]); |
| 273 |
|
|
| 274 |
|
$view = $this->getMock('\OC\Files\View', ['resolvePath']); |
| 275 |
|
$view->expects($this->any()) |
| 276 |
|
->method('resolvePath') |
| 277 |
|
->will($this->returnCallback(function ($path) use ($storage) { |
| 278 |
|
return [$storage, ltrim($path, '/')]; |
| 279 |
|
})); |
| 280 |
|
|
| 281 |
|
$rootNode = $this->getMockBuilder('\OC\Connector\Sabre\Directory') |
| 282 |
|
->disableOriginalConstructor() |
| 283 |
|
->getMock(); |
| 284 |
|
$mountManager = $this->getMock('\OC\Files\Mount\Manager'); |
| 285 |
|
|
| 286 |
|
$tree = new \OC\Connector\Sabre\ObjectTree(); |
| 287 |
|
$tree->init($rootNode, $view, $mountManager); |
| 288 |
|
|
| 289 |
|
$this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path)); |
| 290 |
|
} |
| 291 |
|
|
| 292 |
|
/** |
| 293 |
|
* @expectedException \Sabre\DAV\Exception\Forbidden |