public function testGetEtag() { $this->testCreateFile(); $node = $this->_controller->stat($this->_basePath . '/PHPUNIT/phpunit.txt'); $etag = $this->_controller->getETag($this->_basePath . '/PHPUNIT/phpunit.txt'); $this->assertEquals($node->hash, $etag); }
/** * add attachement to record * * @param Tinebase_Record_Abstract $record * @param string $name * @param mixed $attachment @see Tinebase_FileSystem::copyTempfile * @return null|Tinebase_Model_Tree_Node */ public function addRecordAttachment(Tinebase_Record_Abstract $record, $name, $attachment) { // only occurs via unittests if (!$name && isset($attachment->tempFile) && !is_resource($attachment->tempFile)) { $attachment = Tinebase_TempFile::getInstance()->getTempFile($attachment->tempFile); $name = $attachment->name; } if ($attachment instanceof Tinebase_Model_Tree_Node && empty($name)) { $name = $attachment->name; } if (empty($name)) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Could not evaluate attachment name.'); } return null; } $attachmentsDir = $this->getRecordAttachmentPath($record, TRUE); $attachmentPath = $attachmentsDir . '/' . $name; if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Creating new record attachment ' . $attachmentPath); } if ($this->_fsController->fileExists($attachmentPath)) { throw new Tinebase_Exception_InvalidArgument('File already exists'); } $this->_fsController->copyTempfile($attachment, $attachmentPath); $node = $this->_fsController->stat($attachmentPath); return $node; }
/** * testDeleteDirectoryNodes */ public function testDeleteDirectoryNodes() { $dirpaths = $this->testCreateDirectoryNodesInShared(); $result = $this->_json->deleteNodes($dirpaths); // check if node is deleted $this->setExpectedException('Tinebase_Exception_NotFound'); $node = $this->_fsController->stat(Filemanager_Controller_Node::getInstance()->addBasePath($dirpaths[0])); }
/** * delete node in backend * * @param Tinebase_Model_Tree_Node_Path $_path * @return boolean */ protected function _deleteNodeInBackend(Tinebase_Model_Tree_Node_Path $_path) { $success = FALSE; $node = $this->_backend->stat($_path->statpath); if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Removing path ' . $_path->flatpath . ' of type ' . $node->type); } switch ($node->type) { case Tinebase_Model_Tree_Node::TYPE_FILE: $success = $this->_backend->unlink($_path->statpath); break; case Tinebase_Model_Tree_Node::TYPE_FOLDER: $success = $this->_backend->rmdir($_path->statpath, TRUE); break; } return $success; }