예제 #1
0
 /**
  * prepare file cache for testRemoveBrokenShares()
  */
 private function prepareFileCache()
 {
     // some previous tests didn't clean up and therefore this has to be done here
     // FIXME: DIRTY HACK - TODO: find tests, that don't clean up and fix it there
     $this->tearDown();
     // add items except one - because this is the test case for the broken share table
     $addItems = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` (`storage`, `path_hash`, ' . '`parent`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`) ' . 'VALUES (1, ?, 1, 1, 1, 1, 1, 1)');
     $items = array(1, 3);
     $fileIds = array();
     foreach ($items as $item) {
         // the number is used as path_hash
         $addItems->execute(array($item));
         $fileIds[] = \OC_DB::insertId('*PREFIX*filecache');
     }
     $addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`file_source`, `item_type`, `uid_owner`) VALUES (?, \'file\', 1)');
     // the number is used as item_source
     $addShares->execute(array($fileIds[0]));
     $addShares->execute(array(200));
     // id of "deleted" file
     $addShares->execute(array($fileIds[1]));
     // add a few unrelated shares, calendar share that must be left untouched
     $addShares = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_source`, `item_type`, `uid_owner`) VALUES (?, \'calendar\', 1)');
     // the number is used as item_source
     $addShares->execute(array(999));
 }