/** * test creating a folder in a folder with the same name (below personal folders) * * @see: https://forge.tine20.org/mantisbt/view.php?id=10132 */ public function testCreateFolderInFolderWithSameName() { $path = '/personal/' . Tinebase_Core::getUser()->accountLoginName . '/' . $this->_getPersonalFilemanagerContainer()->name; $this->_json->createNode($path . '/Test1', 'folder', NULL, FALSE); $this->_json->createNode($path . '/Test1/Test1', 'folder', NULL, FALSE); $e = new Tinebase_Exception('nothing'); try { $this->_json->createNode($path . '/Test1/Test1/Test2', 'folder', NULL, FALSE); } catch (Exception $e) { $this->fail('The folder couldn\'t be found, so it hasn\'t ben created'); } $this->assertEquals('nothing', $e->getMessage()); }
/** * testCreateFileNodeWithTempfile * * @return array node */ public function testCreateFileNodeWithTempfile() { $sharedContainerNode = $this->testCreateContainerNodeInSharedFolder(); $this->_objects['paths'][] = Filemanager_Controller_Node::getInstance()->addBasePath($sharedContainerNode['path']); $filepath = $sharedContainerNode['path'] . '/test.txt'; // create empty file first (like the js frontend does) $result = $this->_json->createNode($filepath, Tinebase_Model_Tree_Node::TYPE_FILE, array(), FALSE); $tempFileBackend = new Tinebase_TempFile(); $tempFile = $tempFileBackend->createTempFile(dirname(dirname(__FILE__)) . '/files/test.txt'); $result = $this->_json->createNode($filepath, Tinebase_Model_Tree_Node::TYPE_FILE, $tempFile->getId(), TRUE); $this->assertEquals('text/plain', $result['contenttype'], print_r($result, TRUE)); $this->assertEquals(17, $result['size']); return $result; }