request = $this->getMockBuilder('\OCP\IRequest') ->disableOriginalConstructor() ->getMock() ; $this->settings = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor() ->getMock() ; $this->l10n = $this->getMockBuilder('\OCP\IL10N') ->disableOriginalConstructor() ->getMock() ; $this->cache = $this->getMockBuilder('\OCP\ICacheFactory') ->disableOriginalConstructor() ->getMock() ; $this->controller = new DocumentController( $this->appName, $this->request, $this->settings, $this->l10n, $this->uid, $this->cache ); $userManager = \OC::$server->getUserManager(); $userSession = \OC::$server->getUserSession(); if (!$userManager->userExists($this->uid)){ $userManager->createUser($this->uid, $this->password); \OC::$server->getUserFolder($this->uid); } $userSession->login($this->uid, $this->password); \OC_Util::setupFS(); } /** * @expectedException \OCP\Files\NotFoundException */ public function testRename(){ $result = array( 'status' => 'error', 'message' => (string) $this->l10n->t('You don\'t have permission to rename this document') ); $this->request->post = array( 'fileId' => 500, 'name' => 'newname.ext' ); $response = $this->controller->rename(500); } }