/**
  * @since 1.9
  *
  * @return ContentParser
  */
 public function ContentParser()
 {
     $contentParser = $this->getMockBuilder('\\SMW\\ContentParser')->disableOriginalConstructor()->getMock();
     $contentParser->expects($this->any())->method('getOutput')->will($this->returnValue($this->builder->setValue('getOutput', $this->builder->newObject('ParserOutput'))));
     $contentParser->expects($this->any())->method('getErrors')->will($this->returnValue($this->builder->setValue('getErrors', array())));
     $contentParser->expects($this->any())->method('getRevision')->will($this->returnValue($this->builder->setValue('getRevision', null)));
     return $contentParser;
 }
 /**
  * @return QueryResult
  */
 private function buildMockQueryResult($setup)
 {
     $mockBuilder = new MockObjectBuilder();
     $mockBuilder->registerRepository(new CoreMockObjectRepository());
     $printRequests = array();
     $resultArray = array();
     foreach ($setup as $value) {
         $printRequest = $mockBuilder->newObject('PrintRequest', array('getText' => $value['printRequest'], 'getLabel' => $value['printRequest']));
         $printRequests[] = $printRequest;
         $dataItem = $mockBuilder->newObject('DataItem', array('getDIType' => SMWDataItem::TYPE_NUMBER, 'getNumber' => $value['number']));
         $dataValue = $mockBuilder->newObject('DataValue', array('DataValueType' => 'SMWNumberValue', 'getTypeID' => '_num', 'getShortWikiText' => $value['dataValue'], 'getDataItem' => $dataItem));
         $resultArray[] = $mockBuilder->newObject('ResultArray', array('getText' => $value['printRequest'], 'getPrintRequest' => $printRequest, 'getNextDataValue' => $dataValue, 'getNextDataItem' => $dataItem));
     }
     $queryResult = $mockBuilder->newObject('QueryResult', array('getPrintRequests' => $printRequests, 'getNext' => $resultArray, 'getLink' => new \SMWInfolink(true, 'Lala', 'Lula'), 'hasFurtherResults' => true));
     return $queryResult;
 }
 /**
  * @return array
  */
 public function standardTableDataProvider()
 {
     $mockBuilder = new MockObjectBuilder();
     $mockBuilder->registerRepository(new CoreMockObjectRepository());
     $provider = array();
     $labels = array('pr-1' => 'PrintRequest-PageValue', 'pr-2' => 'PrintRequest-NumberValue', 'ra-1' => 'ResultArray-PageValue', 'ra-2' => 9001);
     $printRequests = array();
     $printRequests['pr-1'] = $mockBuilder->newObject('PrintRequest', array('getText' => $labels['pr-1']));
     $printRequests['pr-2'] = $mockBuilder->newObject('PrintRequest', array('getText' => $labels['pr-2']));
     $datItems = array();
     $datItems['ra-1'] = DIWikiPage::newFromTitle(Title::newFromText($labels['ra-1'], NS_MAIN));
     $datItems['ra-2'] = $mockBuilder->newObject('DataItem', array('getSortKey' => $labels['ra-2']));
     $dataValues = array();
     $dataValues['ra-1'] = $mockBuilder->newObject('DataValue', array('DataValueType' => 'SMWWikiPageValue', 'getTypeID' => '_wpg', 'getShortText' => $labels['ra-1'], 'getDataItem' => $datItems['ra-1']));
     $dataValues['ra-2'] = $mockBuilder->newObject('DataValue', array('DataValueType' => 'SMWNumberValue', 'getTypeID' => '_num', 'getShortText' => $labels['ra-2'], 'getDataItem' => $datItems['ra-2']));
     $resultArray = array();
     $resultArray['ra-1'] = $mockBuilder->newObject('ResultArray', array('getText' => $labels['ra-1'], 'getPrintRequest' => $printRequests['pr-1'], 'getNextDataValue' => $dataValues['ra-1']));
     $resultArray['ra-2'] = $mockBuilder->newObject('ResultArray', array('getText' => $labels['ra-2'], 'getPrintRequest' => $printRequests['pr-2'], 'getNextDataValue' => $dataValues['ra-2']));
     $queryResult = $mockBuilder->newObject('QueryResult', array('getPrintRequests' => array($printRequests['pr-1'], $printRequests['pr-2']), 'getNext' => array($resultArray['ra-1'], $resultArray['ra-2']), 'getQueryLink' => new \SMWInfolink(true, 'Lala', 'Lula'), 'hasFurtherResults' => true));
     // #0 standard table
     $parameters = array('headers' => SMW_HEADERS_PLAIN, 'class' => 'tableClass', 'format' => 'table', 'offset' => 0, 'transpose' => false);
     $matcher = array('<table class="tableClass">', '<th class="PrintRequest-PageValue">PrintRequest-PageValue</th>', '<th class="PrintRequest-NumberValue">PrintRequest-NumberValue</th>', '<tr data-row-number="1" class="row-odd">', 'class="PrintRequest-PageValue smwtype_wpg">ResultArray-PageValue</td>', '<td data-sort-value="9001"', 'class="PrintRequest-NumberValue smwtype_num">9001</td></tr>', '<tr class="smwfooter row-even">', '<td class="sortbottom">', '<span class="smw-table-furtherresults">');
     $provider[] = array(array('parameters' => $parameters, 'queryResult' => $queryResult, 'outputMode' => SMW_OUTPUT_FILE), array('matcher' => $matcher));
     // #1 broadtable table
     $parameters = array('headers' => SMW_HEADERS_PLAIN, 'class' => 'tableClass', 'format' => 'broadtable', 'offset' => 0, 'transpose' => false);
     $matcher = array('<table class="tableClass" width="100%">', '<th class="PrintRequest-PageValue">PrintRequest-PageValue</th>', '<th class="PrintRequest-NumberValue">PrintRequest-NumberValue</th>', '<tr class="smwfooter row-odd">', '<td class="sortbottom">', '<span class="smw-broadtable-furtherresults">');
     $provider[] = array(array('parameters' => $parameters, 'queryResult' => $queryResult, 'outputMode' => SMW_OUTPUT_FILE), array('matcher' => $matcher));
     // #2 "headers=hide"
     $parameters = array('headers' => SMW_HEADERS_HIDE, 'class' => 'tableClass', 'format' => 'table', 'offset' => 0, 'transpose' => false);
     $matcher = array('<table class="tableClass">', '<tr class="smwfooter row-odd">', '<td class="sortbottom">', '<span class="smw-table-furtherresults">');
     $provider[] = array(array('parameters' => $parameters, 'queryResult' => $queryResult, 'outputMode' => SMW_OUTPUT_FILE), array('matcher' => $matcher));
     // #3 "transpose=true"
     $parameters = array('headers' => SMW_HEADERS_PLAIN, 'class' => 'tableClass', 'format' => 'table', 'offset' => 0, 'transpose' => true);
     //TODO add proper matching data, which I can't seem to get to work.
     //MWJames would you mind doing the honors?
     $matcher = array();
     $provider[] = array(array('parameters' => $parameters, 'queryResult' => $queryResult, 'outputMode' => SMW_OUTPUT_FILE), array('matcher' => $matcher));
     return $provider;
 }