public function testOpenFile()
 {
     $this->testCreateFile();
     $handle = $this->_controller->fopen($this->_basePath . '/PHPUNIT/phpunit.txt', 'r');
     $this->assertEquals('phpunit', stream_get_contents($handle), 'file content mismatch');
     $this->_controller->fclose($handle);
 }
Example #2
0
 /**
  * delete node in backend
  * 
  * @param string $_statpath
  * @param type
  * @param string $_tempFileId
  * @return Tinebase_Model_Tree_Node
  */
 protected function _createNodeInBackend($_statpath, $_type, $_tempFileId = NULL)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Creating new path ' . $_statpath . ' of type ' . $_type);
     }
     switch ($_type) {
         case Tinebase_Model_Tree_Node::TYPE_FILE:
             if (!($handle = $this->_backend->fopen($_statpath, 'w'))) {
                 throw new Tinebase_Exception_AccessDenied('Permission denied to create file (filename ' . $_statpath . ')');
             }
             if ($_tempFileId !== NULL) {
                 $this->_copyTempfile($_tempFileId, $handle);
                 $this->_backend->clearStatCache($_statpath);
             }
             $this->_backend->fclose($handle);
             break;
         case Tinebase_Model_Tree_Node::TYPE_FOLDER:
             $this->_backend->mkdir($_statpath);
             break;
     }
     return $this->_backend->stat($_statpath);
 }