/** * @depends testAddToEntityList */ public function testAddAnotherToEntityList() { $dataItem = DIWikiPage::newFromText('Bar'); $this->query->expects($this->any())->method('getQueryId')->will($this->returnValue('FOO:BAR')); $instance = new EntityListAccumulator($this->query); $instance->addToEntityList($dataItem); $this->assertEquals(array('FOO:BAR' => array('Bar#0#' => $dataItem)), $instance->getEntityList()); }
/** * Return an SMWDataValue object for the next SMWDataItem object or * false if no further object exists. * * @since 1.6 * * @return SMWDataValue|false */ public function getNextDataValue() { $dataItem = $this->getNextDataItem(); if ($dataItem === false) { return false; } if ($this->mPrintRequest->getMode() == PrintRequest::PRINT_PROP && strpos($this->mPrintRequest->getTypeID(), '_rec') !== false && $this->mPrintRequest->getParameter('index') !== false) { $recordValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $this->mPrintRequest->getData()->getDataItem()); $diProperty = $recordValue->getPropertyDataItemByIndex($this->mPrintRequest->getParameter('index')); } elseif ($this->mPrintRequest->isMode(PrintRequest::PRINT_PROP)) { $diProperty = $this->mPrintRequest->getData()->getDataItem(); } elseif ($this->mPrintRequest->isMode(PrintRequest::PRINT_CHAIN)) { $diProperty = $this->mPrintRequest->getData()->getLastPropertyChainValue()->getDataItem(); } else { $diProperty = null; } // refs #1314 if ($this->mPrintRequest->getMode() == PrintRequest::PRINT_PROP && strpos($this->mPrintRequest->getTypeID(), '_txt') !== false && $dataItem instanceof DIBlob) { $dataItem = new DIBlob(InTextAnnotationParser::removeAnnotation($dataItem->getString())); } $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $diProperty); $dataValue->setContextPage($this->mResult); if ($this->mPrintRequest->getOutputFormat()) { $dataValue->setOutputFormat($this->mPrintRequest->getOutputFormat()); } if ($this->entityListAccumulator !== null && $dataItem instanceof DataItem) { $this->entityListAccumulator->addToEntityList($dataItem, $diProperty); } return $dataValue; }