예제 #1
0
 /**
  * testMoveFolderNodeToRoot
  */
 public function testMoveFolderNodeToRoot()
 {
     $children = $this->testCreateDirectoryNodesInPersonal();
     $target = '/' . Tinebase_Model_Container::TYPE_PERSONAL . '/' . Tinebase_Core::getUser()->accountLoginName;
     $this->_objects['paths'][] = Filemanager_Controller_Node::getInstance()->addBasePath($target . '/testcontainer');
     $result = $this->_json->moveNodes($children[0], $target, FALSE);
     $this->assertEquals(1, count($result));
     $this->assertTrue(is_array($result[0]['name']), 'array with container data expected: ' . print_r($result[0], TRUE));
     $this->_objects['containerids'][] = $result[0]['name']['id'];
 }
 /**
  * test to move a folder containing another folder
  *
  * @see: https://forge.tine20.org/mantisbt/view.php?id=9990
  */
 public function testMove2FoldersOnToplevel()
 {
     $path = '/personal/' . Tinebase_Core::getUser()->accountLoginName . '/' . $this->_getPersonalFilemanagerContainer()->name;
     $this->_json->createNode($path . '/Parent', 'folder', NULL, FALSE);
     $this->_json->createNode($path . '/Parent/Child', 'folder', NULL, FALSE);
     $this->_json->createNode('/shared/Another', 'folder', NULL, FALSE);
     // move forth and back, no exception should occur
     $this->_json->moveNodes(array($path . '/Parent'), array('/shared/Parent'), FALSE);
     $this->_json->moveNodes(array('/shared/Parent'), array($path . '/Parent'), FALSE);
     try {
         $c = Tinebase_Container::getInstance()->getContainerByName('Filemanager', 'Parent', Tinebase_Model_Container::TYPE_SHARED);
         $this->fail('Container doesn\'t get deleted');
     } catch (Tinebase_Exception_NotFound $e) {
     }
     // may be any exception
     $e = new Tinebase_Exception('Dog eats cat');
     try {
         $this->_json->moveNodes(array($path . '/Parent'), array('/shared/Parent'), FALSE);
     } catch (Filemanager_Exception_NodeExists $e) {
     }
     // if $e gets overridden, an error occured (the exception Filemanager_Exception_NodeExists must not be thrown)
     $this->assertEquals('Tinebase_Exception', get_class($e));
 }