/** * test copying directory to existing directory */ public function testCopySourceAndDestinationTheSame() { $sourcePath = $this->testCreateFile(); $destinationPath = $this->testMkdir(); $this->setExpectedException('Tinebase_Exception_UnexpectedValue'); $createdNode = $this->_controller->copy($sourcePath, $destinationPath); }
/** * copy file node * * @param Tinebase_Model_Tree_Node_Path $_source * @param Tinebase_Model_Tree_Node_Path $_destination * @param string $_action * @param boolean $_forceOverwrite * @return Tinebase_Model_Tree_Node */ protected function _copyOrMoveFileNode(Tinebase_Model_Tree_Node_Path $_source, Tinebase_Model_Tree_Node_Path $_destination, $_action, $_forceOverwrite = FALSE) { $this->_checkPathACL($_destination->getParent(), 'update', FALSE); try { $this->_checkIfExists($_destination); } catch (Filemanager_Exception_NodeExists $fene) { if ($_forceOverwrite && $_source->statpath !== $_destination->statpath) { // delete old node $this->_backend->unlink($_destination->statpath); } elseif (!$_forceOverwrite) { throw $fene; } } switch ($_action) { case 'copy': $newNode = $this->_backend->copy($_source->statpath, $_destination->statpath); break; case 'move': $newNode = $this->_backend->rename($_source->statpath, $_destination->statpath); break; } return $newNode; }