/** * @expectedException \OCP\Files\InvalidPathException */ public function testInvalidPath() { $manager = $this->getMock('\OC\Files\Mount\Manager'); /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ $view = $this->getMock('\OC\Files\View'); $root = $this->getMock('\OC\Files\Node\Root', array(), array($manager, $view, $this->user)); $node = new \OC\Files\Node\Node($root, $view, '/../foo'); $node->getFileInfo(); }
/** * @expectedException \OCP\Files\NotPermittedException */ public function testTouchNotPermitted() { $manager = $this->getMock('\\OC\\Files\\Mount\\Manager'); /** * @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view */ $view = $this->getMock('\\OC\\Files\\View'); $root = $this->getMock('\\OC\\Files\\Node\\Root', array(), array($manager, $view, $this->user)); $root->expects($this->any())->method('getUser')->will($this->returnValue($this->user)); $view->expects($this->any())->method('getFileInfo')->with('/bar/foo')->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ))); $node = new \OC\Files\Node\Node($root, $view, '/bar/foo'); $node->touch(100); }