function testCloneFilter() { $mdFactory = new MockDocman_MetadataFactory(); $mdFactory->setReturnValue('isRealMetadata', false); $md = new Docman_ListMetadata(); $md->setLabel('item_type'); $srcFilter = new Docman_FilterItemType($md); $dstReport = new Docman_Report(); $dstReport->setGroupId(123); $filterFactory = new Docman_FilterFactoryTestVersion($this); $gsMd = new Docman_Metadata(); $filterFactory->setReturnValue('getGlobalSearchMetadata', $gsMd); $gsMd->setLabel('global_txt'); $itMd = new Docman_ListMetadata(); $filterFactory->setReturnValue('getItemTypeSearchMetadata', $itMd); $itMd->setLabel('item_type'); $itMd->setUseIt(PLUGIN_DOCMAN_METADATA_USED); $metadataMapping = array('md' => array(), 'love' => array()); $dstFilterFactory = new Docman_FilterFactoryTestVersion($this); $filterFactory->setReturnValue('getFilterFactory', $dstFilterFactory); $filterFactory->cloneFilter($srcFilter, $dstReport, $metadataMapping); $dstFilterFactory->expectOnce('createFromMetadata'); $filterFactory->expectOnce('cloneFilterValues'); $dstFilterFactory->expectOnce('createFilter'); }
function getReportById($id) { $report = null; $dao =& $this->getDao(); $dar = $dao->searchById($id); if ($dar && !$dar->isError() && $dar->rowCount() == 1) { $report = new Docman_Report(); $report->initFromRow($dar->current()); } return $report; }