/** * Load results of the given print request and result subject. This is only * done when needed. */ protected function loadContent() { if ($this->mContent !== false) { return; } $this->mContent = $this->resultFieldMatchFinder->getResultsBy($this->mResult); return reset($this->mContent); }
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)); }