示例#1
0
 function testRestoreDeletedItemNonFile()
 {
     $itemFactory = new Docman_ItemFactoryTestRestore($this);
     $item = new MockDocman_Folder($this);
     $item->setReturnValue('getId', 112);
     $item->setReturnValue('getGroupId', 114);
     $dao = new MockDocman_ItemDao($this);
     $dao->expectOnce('restore', array(112));
     $dao->setReturnValue('restore', true);
     $itemFactory->setReturnValue('_getItemDao', $dao);
     // Event
     $user = new MockUser($this);
     $um = new MockUserManager($this);
     $um->setReturnValue('getCurrentUser', $user);
     $itemFactory->setReturnValue('_getUserManager', $um);
     $em = new MockEventManager($this);
     $em->expectOnce('processEvent', array('plugin_docman_event_restore', array('group_id' => 114, 'item' => $item, 'user' => $user)));
     $itemFactory->setReturnValue('_getEventManager', $em);
     $this->assertTrue($itemFactory->restore($item));
 }
 /**
  * Testing when the item is duplicated
  */
 function testGetChildDuplicatedDifferentCase()
 {
     $webDAVDocmanFolder = new WebDAVDocmanFolderTestVersion3($this);
     $item1 = new MockDocman_Folder();
     $item1->setReturnValue('getTitle', 'SameName');
     $item2 = new MockDocman_Folder();
     $item2->setReturnValue('getTitle', 'samename');
     $docmanItemFactory = new MockDocman_ItemFactory();
     $docmanItemFactory->setReturnValue('getChildrenFromParent', array($item1, $item2));
     $utils = new MockWebDAVUtils();
     $docmanPermissionManager = new MockDocman_PermissionsManager();
     $docmanPermissionManager->setReturnValue('userCanAccess', true);
     $utils->setReturnValue('getDocmanPermissionsManager', $docmanPermissionManager);
     $utils->setReturnValue('getDocmanItemFactory', $docmanItemFactory);
     $utils->setReturnValue('retrieveName', 'SameName');
     $webDAVDocmanFolder->setReturnValue('getUtils', $utils);
     $webDAVDocmanFolder->setReturnValue('getWebDAVDocmanFolder', $item1);
     $this->expectException('Sabre_DAV_Exception_Conflict');
     $webDAVDocmanFolder->getChild('SameName');
 }