/** * testCreateDirectoryNodesInPersonal * * @return array dir paths */ public function testCreateDirectoryNodesInPersonal() { $personalContainerNode = $this->testCreateContainerNodeInPersonalFolder(); $this->_objects['paths'][] = Filemanager_Controller_Node::getInstance()->addBasePath($personalContainerNode['path']); $dirpaths = array($personalContainerNode['path'] . '/dir1', $personalContainerNode['path'] . '/dir2'); $result = $this->_json->createNodes($dirpaths, Tinebase_Model_Tree_Node::TYPE_FOLDER, array(), FALSE); $this->assertEquals(2, count($result)); $this->assertEquals('dir1', $result[0]['name']); $this->assertEquals('dir2', $result[1]['name']); $filter = array(array('field' => 'path', 'operator' => 'equals', 'value' => $personalContainerNode['path']), array('field' => 'type', 'operator' => 'equals', 'value' => Tinebase_Model_Tree_Node::TYPE_FOLDER)); $result = $this->_json->searchNodes($filter, array('sort' => 'contenttype')); $this->assertEquals(2, $result['totalcount']); return $dirpaths; }
/** * testMoveContainerFolderNodeToExistingContainer * * @see 0007028: moving a folder to another folder with a folder with the same name */ public function testMoveContainerFolderNodeToExistingContainer() { $targetNode = $this->testCreateContainerNodeInPersonalFolder(); $testPath = '/' . Tinebase_Model_Container::TYPE_PERSONAL . '/' . Tinebase_Core::getUser()->accountLoginName . '/testcontainer2'; $result = $this->_json->createNodes($testPath, Tinebase_Model_Tree_Node::TYPE_FOLDER, array(), FALSE); $createdNode = $result[0]; $this->_objects['containerids'][] = $createdNode['name']['id']; try { $result = $this->_json->moveNodes(array($targetNode['path']), array($createdNode['path']), FALSE); $this->fail('Expected Filemanager_Exception_NodeExists!'); } catch (Filemanager_Exception_NodeExists $fene) { $result = $this->_json->moveNodes(array($targetNode['path']), array($createdNode['path']), TRUE); $this->assertEquals(1, count($result)); $this->assertEquals($testPath, $result[0]['path']); } }