/**
  * tx_dam::process_createFile()
  */
 public function test_process_createFile()
 {
     $this->removeFixtureTempFiles();
     $this->removeIndexSetup();
     $this->removeFixturesFromIndex();
     $this->addFixturePathToFilemount();
     $filepath = $this->getFixtureTempFilename('txt');
     unlink($filepath);
     $content = $this->getFixtureContent('txt');
     tx_dam::process_createFile($filepath, $content);
     $uid = tx_dam::file_isIndexed($filepath);
     self::assertUID($uid, 'File index not found');
     $data = tx_dam::meta_getDataByUid($uid, 'abstract');
     self::assertEquals(substr($data['abstract'], 0, 100), substr($content, 0, 100));
     $this->removeFixturePathFromFilemount();
     $this->removeFixturesFromIndex();
     $this->removeIndexSetup();
     $this->removeFixtureTempFiles();
 }
 /**
  * Main function, rendering the content of the rename form
  *
  * @return	void
  */
 function main()
 {
     global $LANG;
     $content = '';
     // Cleaning and checking target
     $this->folder = tx_dam::path_compileInfo($this->pObj->folder[0]);
     if (is_array($this->pObj->data) and $this->pObj->data['file_name']) {
         // create the file and process DB update
         $error = tx_dam::process_createFile($this->folder['dir_path_absolute'] . $this->pObj->data['file_name'], $this->pObj->data['file_content']);
         if ($error) {
             $content .= $GLOBALS['SOBE']->getMessageBox($LANG->getLL('error'), htmlspecialchars($error), '', 2);
             $content .= $this->renderForm();
         } else {
             $this->pObj->redirect(true);
         }
     } elseif ($this->folder['dir_accessable']) {
         $content .= $this->renderForm();
     } else {
         // this should have happen in index.php already
         $content .= $this->pObj->accessDeniedMessageBox(tx_dam_guiFunc::getFolderInfoBar($this->folder));
     }
     return $content;
 }