public function testGetResultsBy_PROP() { $dataItem = $this->dataItemFactory->newDIWikiPage('Bar'); $expected = $this->dataItemFactory->newDIWikiPage(__METHOD__); $store = $this->getMockBuilder('\\SMW\\Store')->disableOriginalConstructor()->getMockForAbstractClass(); $store->expects($this->once())->method('getPropertyValues')->with($this->equalTo($dataItem), $this->equalTo($this->dataItemFactory->newDIProperty('Prop')))->will($this->returnValue(array($expected))); $printRequest = $this->getMockBuilder('\\SMW\\Query\\PrintRequest')->disableOriginalConstructor()->getMock(); $printRequest->expects($this->at(3))->method('isMode')->with($this->equalTo(PrintRequest::PRINT_PROP))->will($this->returnValue(true)); $printRequest->expects($this->any())->method('getParameter')->will($this->returnValue(false)); $printRequest->expects($this->once())->method('getData')->will($this->returnValue($this->dataValueFactory->newPropertyValueByLabel('Prop'))); $instance = new ResultFieldMatchFinder($store, $printRequest); $this->assertEquals(array($expected), $instance->getResultsBy($dataItem)); }
/** * Make a request option object based on the given parameters, and * return NULL if no such object is required. The parameter defines * if the limit should be taken into account, which is not always desired * (especially if results are to be cached for future use). * * @param boolean $useLimit * * @return SMWRequestOptions|null */ protected function getRequestOptions($useLimit = true) { return $this->resultFieldMatchFinder->getRequestOptions($useLimit); }