public function testGetDefaultUploadTreeView() { $this->prepareUploadTree($upload = 4); $options = array(UploadTreeProxy::OPT_ITEM_FILTER => "AND ufile_name='dirA'"); $uploadTreeProxy = new UploadTreeProxy(4, $options, $uploadTreeTableName = 'uploadtree_a'); $stmt = __METHOD__; $this->dbManager->prepare($stmt, $uploadTreeProxy->asCTE() . " SELECT uploadtree_pk FROM " . $uploadTreeProxy->getDbViewName()); $res = $this->dbManager->execute($stmt, $uploadTreeProxy->getParams()); $descendantsT = $this->dbManager->fetchAll($res); $this->dbManager->freeResult($res); $zipDescendantsT = array_reduce($descendantsT, function ($foo, $bar) { $foo[] = $bar['uploadtree_pk']; return $foo; }, array()); assertThat($zipDescendantsT, equalTo(array(302))); }
/** * @var ItemTreeBounds $itemTreeBounds * @param $uploadTreeView * @return int */ public function getContainingFileCount(ItemTreeBounds $itemTreeBounds, UploadTreeProxy $uploadTreeView) { $sql = "SELECT count(*) FROM " . $uploadTreeView->getDbViewName() . " WHERE lft BETWEEN \$1 AND \$2"; $result = $this->dbManager->getSingleRow($sql, array($itemTreeBounds->getLeft(), $itemTreeBounds->getRight()), __METHOD__ . $uploadTreeView->asCTE()); $output = $result['count']; return $output; }