public function testDeleteFile() { $this->testCreateFile(); $this->_controller->unlink($this->_basePath . '/PHPUNIT/phpunit.txt'); $children = $this->_controller->scanDir($this->_basePath . '/PHPUNIT')->name; $this->assertTrue(!in_array('phpunit.txt', $children)); }
/** * fetch all file attachments of a record * * @param Tinebase_Record_Interface $record * @return Tinebase_Record_RecordSet of Tinebase_Model_Tree_Node */ public function getRecordAttachments(Tinebase_Record_Interface $record) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Fetching attachments of ' . get_class($record) . ' record with id ' . $record->getId() . ' ...'); } $parentPath = $this->getRecordAttachmentPath($record); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Looking in path ' . $parentPath); } try { $record->attachments = $this->_fsController->scanDir($parentPath); } catch (Tinebase_Exception_NotFound $tenf) { $record->attachments = new Tinebase_Record_RecordSet('Tinebase_Model_Tree_Node'); } if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG) && count($record->attachments) > 0) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found ' . count($record->attachments) . ' attachment(s).'); } return $record->attachments; }