Mwjames has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91042


Change subject: Remove clutter
......................................................................

Remove clutter

Change-Id: I4d601a6f861642f5863cf1742d648488fd735c83
---
M includes/api/ApiAsk.php
M includes/api/ApiBase.php
M includes/api/ApiBrowse.php
M includes/api/ApiQuery.php
M includes/formatters/ApiQueryResultFormatter.php
M tests/phpunit/includes/formatters/ApiQueryResultFormatterTest.php
6 files changed, 314 insertions(+), 421 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki 
refs/changes/42/91042/1

diff --git a/includes/api/ApiAsk.php b/includes/api/ApiAsk.php
index 3e0d268..63b7772 100644
--- a/includes/api/ApiAsk.php
+++ b/includes/api/ApiAsk.php
@@ -7,6 +7,8 @@
 /**
  * API module to query SMW by providing a query in the ask language.
  *
+ * @ingroup Api
+ *
  * @licence GNU GPL v2+
  * @since 1.6.2
  *
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 0b7268d..0c0dcbf 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -5,6 +5,8 @@
 /**
  * Semantic MediaWiki Api Base class
  *
+ * @ingroup Api
+ *
  * @licence GNU GPL v2+
  * @since 1.9
  *
@@ -14,18 +16,6 @@
 
        /** @var ContextResource */
        protected $context = null;
-
-       /**
-        * @see ApiBase::__construct
-        *
-        * @since 1.9
-        *
-        * @param ApiMain $main
-        * @param string $action Name of this module
-        */
-       public function __construct( $main, $action ) {
-               parent::__construct( $main, $action );
-       }
 
        /**
         * @see ContextInjector::invokeContext
diff --git a/includes/api/ApiBrowse.php b/includes/api/ApiBrowse.php
index 2e84d17..109a138 100644
--- a/includes/api/ApiBrowse.php
+++ b/includes/api/ApiBrowse.php
@@ -7,6 +7,8 @@
 /**
  * Api module to browse a subject
  *
+ * @ingroup Api
+ *
  * @licence GNU GPL v2+
  * @since 1.9
  *
@@ -55,11 +57,12 @@
         */
        protected function getSemanticData( DIWikiPage $subject ) {
 
-               $semanticData = 
$this->withContext()->getStore()->getSemanticData( $subject );
+               $store = $this->withContext()->getStore();
+               $semanticData = $store->getSemanticData( $subject );
 
                foreach ( $semanticData->getProperties() as $property ) {
                        if ( $property->getKey() === DIProperty::TYPE_SUBOBJECT 
|| $property->getKey() === DIProperty::TYPE_ASKQUERY ) {
-                               $this->addSubSemanticData( $property, 
$semanticData );
+                               $this->addSubSemanticData( $store, $property, 
$semanticData );
                        }
                }
 
@@ -78,13 +81,13 @@
         *
         * @since 1.9
         */
-       protected function addSubSemanticData( $property, &$semanticData ) {
+       protected function addSubSemanticData( $store, $property, 
&$semanticData ) {
 
                $subSemanticData = $semanticData->getSubSemanticData();
 
                foreach ( $semanticData->getPropertyValues( $property ) as 
$value ) {
                        if ( $value instanceOf DIWikiPage && !isset( 
$subSemanticData[ $value->getSubobjectName() ] ) ) {
-                               $semanticData->addSubSemanticData( 
$this->withContext()->getStore()->getSemanticData( $value ) );
+                               $semanticData->addSubSemanticData( 
$store->getSemanticData( $value ) );
                        }
                }
        }
diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php
index ab26f7e..39b1541 100644
--- a/includes/api/ApiQuery.php
+++ b/includes/api/ApiQuery.php
@@ -9,6 +9,8 @@
 /**
  * Base for API modules that query SMW
  *
+ * @ingroup Api
+ *
  * @licence GNU GPL v2+
  * @since 1.9
  *
@@ -67,8 +69,7 @@
 
                $resultFormatter = new ApiQueryResultFormatter( $queryResult );
                $resultFormatter->setIsRawMode( $result->getIsRawMode() );
-               $resultFormatter->setFormat( $result->getMain()->getPrinter() 
!== null ? $result->getMain()->getPrinter()->getFormat() : null );
-               $resultFormatter->doFormat();
+               $resultFormatter->runFormatter();
 
                if ( $resultFormatter->getContinueOffset() ) {
                        $result->disableSizeCheck();
@@ -78,4 +79,5 @@
 
                $result->addValue( null, $resultFormatter->getType(), 
$resultFormatter->getResult() );
        }
+
 }
diff --git a/includes/formatters/ApiQueryResultFormatter.php 
b/includes/formatters/ApiQueryResultFormatter.php
index c0b785e..15ca701 100644
--- a/includes/formatters/ApiQueryResultFormatter.php
+++ b/includes/formatters/ApiQueryResultFormatter.php
@@ -6,20 +6,14 @@
 use SMWQueryResult;
 
 /**
- * This class handles the API related formatting of query results
+ * This class handles the Api related query result formatting
  *
- * @file
+ * @ingroup SMW
  *
- * @license GNU GPL v2+
- * @since   1.9
+ * @licence GNU GPL v2+
+ * @since 1.9
  *
  * @author mwjames
- */
-
-/**
- * This class handles the API related formatting of query results
- *
- * @ingroup Formatter
  */
 final class ApiQueryResultFormatter {
 
@@ -28,9 +22,6 @@
 
        /** @var String */
        protected $type;
-
-       /** @var String|null */
-       protected $format = null;
 
        /** @var Boolean */
        protected $isRawMode = false;
@@ -45,96 +36,6 @@
        }
 
        /**
-        * Formatting a result array to support JSON/XML standards
-        *
-        * @since 1.9
-        *
-        * @param array $queryResult
-        *
-        * @return array
-        */
-       public function formatResults( array $queryResult ) {
-
-               $this->type = 'query';
-               $results    = array();
-
-               if ( $this->isXml() ) {
-
-                       foreach ( $queryResult['results'] as $subjectName => 
$subject ) {
-                               $serialized = array();
-
-                               foreach ( $subject as $key => $value ) {
-
-                                       if ( $key === 'printouts' ) {
-                                               $printouts = array();
-
-                                               foreach ( $subject['printouts'] 
as $property => $values ) {
-
-                                                       if ( (array)$values === 
$values ) {
-                                                               
$this->setIndexedTagName( $values, 'value' );
-                                                               $printouts[] = 
array_merge( array( 'label' => $property ), $values );
-                                                       }
-
-                                               }
-
-                                               $serialized['printouts'] = 
$printouts;
-                                               $this->setIndexedTagName( 
$serialized['printouts'], 'property' );
-
-                                       } else {
-                                               $serialized[$key] = $value;
-                                       }
-                               }
-
-                               $results[] = $serialized;
-                       }
-
-                       if ( $results !== array() ) {
-                               $queryResult['results'] = $results;
-                               $this->setIndexedTagName( 
$queryResult['results'], 'subject' );
-                       }
-
-                       $this->setIndexedTagName( 
$queryResult['printrequests'], 'printrequest' );
-                       $this->setIndexedTagName( $queryResult['meta'], 'meta' 
);
-
-               };
-
-               return $queryResult;
-       }
-
-       /**
-        * Formatting an error array in order to support JSON/XML
-        *
-        * @since 1.9
-        *
-        * @param array $errors
-        *
-        * @return array
-        */
-       public function formatErrors( array $errors ) {
-
-               $this->type      = 'error';
-               $result['query'] = $errors;
-
-               if ( $this->isXml() ) {
-                       $this->setIndexedTagName( $result['query'], 'info' );
-               }
-
-               return $result;
-       }
-
-       /**
-        * Sets the printer format and is mainly used for
-        * ApiQueryResultFormatter::isXml
-        *
-        * @since 1.9
-        *
-        * @param string $format
-        */
-       public function setFormat( $format ) {
-               $this->format = strtolower( $format );
-       }
-
-       /**
         * Sets whether the formatter requested raw data and is used in 
connection
         * with ApiQueryResultFormatter::setIndexedTagName
         *
@@ -146,45 +47,6 @@
         */
        public function setIsRawMode( $isRawMode ) {
                $this->isRawMode = $isRawMode;
-       }
-
-       /**
-        * Add '_element' to an array
-        *
-        * @note Copied from ApiResult::setIndexedTagName to avoid having a
-        * constructor injection in order to be able to access this method
-        *
-        * @see ApiResult::setIndexedTagName
-        *
-        * @since 1.9
-        *
-        * @param array &$arr
-        * @param string $tag
-        */
-       public function setIndexedTagName( &$arr, $tag ) {
-
-               if ( !$this->isRawMode ) {
-                       return;
-               }
-
-               if ( $arr === null || $tag === null || !is_array( $arr ) || 
is_array( $tag ) ) {
-                       throw new InvalidArgumentException( "{$tag} was 
incompatible with the requirements" );
-               }
-
-               $arr['_element'] = $tag;
-       }
-
-       /**
-        * Asserts if the current printer format is XML
-        *
-        * @see ApiMain::getPrinter()->getFormat()
-        *
-        * @since 1.9
-        *
-        * @return boolean
-        */
-       public function isXml() {
-               return $this->format === 'xml';
        }
 
        /**
@@ -225,7 +87,7 @@
         *
         * @since 1.9
         */
-       public function doFormat() {
+       public function runFormatter() {
 
                if ( $this->queryResult->getErrors() !== array() ) {
                        $this->result = $this->formatErrors( 
$this->queryResult->getErrors() );
@@ -237,4 +99,107 @@
                        }
                }
        }
+
+       /**
+        * Formatting a result array to support JSON/XML standards
+        *
+        * @since 1.9
+        *
+        * @param array $queryResult
+        *
+        * @return array
+        */
+       protected function formatResults( array $queryResult ) {
+
+               $this->type = 'query';
+               $results    = array();
+
+               if ( !$this->isRawMode ) {
+                       return $queryResult;
+               }
+
+               foreach ( $queryResult['results'] as $subjectName => $subject ) 
{
+                       $serialized = array();
+
+                       foreach ( $subject as $key => $value ) {
+
+                               if ( $key === 'printouts' ) {
+                                       $printouts = array();
+
+                                       foreach ( $subject['printouts'] as 
$property => $values ) {
+
+                                               if ( (array)$values === $values 
) {
+                                                       
$this->setIndexedTagName( $values, 'value' );
+                                                       $printouts[] = 
array_merge( array( 'label' => $property ), $values );
+                                               }
+
+                                       }
+
+                                       $serialized['printouts'] = $printouts;
+                                       $this->setIndexedTagName( 
$serialized['printouts'], 'property' );
+
+                               } else {
+                                       $serialized[$key] = $value;
+                               }
+                       }
+
+                       $results[] = $serialized;
+               }
+
+               if ( $results !== array() ) {
+                       $queryResult['results'] = $results;
+                       $this->setIndexedTagName( $queryResult['results'], 
'subject' );
+               }
+
+               $this->setIndexedTagName( $queryResult['printrequests'], 
'printrequest' );
+               $this->setIndexedTagName( $queryResult['meta'], 'meta' );
+
+               return $queryResult;
+       }
+
+       /**
+        * Formatting an error array in order to support JSON/XML
+        *
+        * @since 1.9
+        *
+        * @param array $errors
+        *
+        * @return array
+        */
+       protected function formatErrors( array $errors ) {
+
+               $this->type      = 'error';
+               $result['query'] = $errors;
+
+               $this->setIndexedTagName( $result['query'], 'info' );
+
+               return $result;
+       }
+
+       /**
+        * Add '_element' to an array
+        *
+        * @note Copied from ApiResult::setIndexedTagName to avoid having a
+        * constructor injection in order to be able to access this method
+        *
+        * @see ApiResult::setIndexedTagName
+        *
+        * @since 1.9
+        *
+        * @param array &$arr
+        * @param string $tag
+        */
+       protected function setIndexedTagName( &$arr, $tag ) {
+
+               if ( !$this->isRawMode ) {
+                       return;
+               }
+
+               if ( $arr === null || $tag === null || !is_array( $arr ) || 
is_array( $tag ) ) {
+                       throw new InvalidArgumentException( "{$tag} was 
incompatible with the requirements" );
+               }
+
+               $arr['_element'] = $tag;
+       }
+
 }
diff --git a/tests/phpunit/includes/formatters/ApiQueryResultFormatterTest.php 
b/tests/phpunit/includes/formatters/ApiQueryResultFormatterTest.php
index 49c35d5..e8c2f0c 100644
--- a/tests/phpunit/includes/formatters/ApiQueryResultFormatterTest.php
+++ b/tests/phpunit/includes/formatters/ApiQueryResultFormatterTest.php
@@ -3,20 +3,8 @@
 namespace SMW\Test;
 
 use SMW\ApiQueryResultFormatter;
-use SMW\ArrayAccessor;
 
 use SMWQueryResult;
-
-/**
- * Tests for the ApiQueryResultFormatter class
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since   1.9
- *
- * @author mwjames
- */
 
 /**
  * @covers \SMW\ApiQueryResultFormatter
@@ -25,12 +13,15 @@
  *
  * @group SMW
  * @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
  */
 class ApiQueryResultFormatterTest extends SemanticMediaWikiTestCase {
 
        /**
-        * Returns the name of the class to be tested
-        *
         * @return string|false
         */
        public function getClass() {
@@ -38,11 +29,7 @@
        }
 
        /**
-        * Helper method that returns a ApiQueryResultFormatter object
-        *
         * @since 1.9
-        *
-        * @param SMWQueryResult $queryResult
         *
         * @return ApiQueryResultFormatter
         */
@@ -56,8 +43,6 @@
        }
 
        /**
-        * @test ApiQueryResultFormatter::__construct
-        *
         * @since 1.9
         */
        public function testConstructor() {
@@ -65,9 +50,6 @@
        }
 
        /**
-        * @test ApiQueryResultFormatter::setIndexedTagName
-        * @test ApiQueryResultFormatter::setIsRawMode
-        *
         * @since 1.9
         */
        public function testSetIndexedTagNameException() {
@@ -76,25 +58,19 @@
 
                $instance = $this->newInstance();
                $instance->setIsRawMode( true );
-               $index = array();
 
-               $instance->setIndexedTagName( $index, null );
-               $this->assertTrue( true );
+               $reflector = $this->newReflector();
+               $method = $reflector->getMethod( 'setIndexedTagName' );
+               $method->setAccessible( true );
+
+               $this->assertTrue( $method->invoke( $instance, array(), null ) 
);
 
        }
 
        /**
-        * @test ApiQueryResultFormatter::doFormat
-        * @test ApiQueryResultFormatter::setIsRawMode
-        * @test ApiQueryResultFormatter::setFormat
-        * @test ApiQueryResultFormatter::getResult
-        * @test ApiQueryResultFormatter::getContinueOffset
         * @dataProvider resultDataProvider
         *
         * @since 1.9
-        *
-        * @param array $test
-        * @param array $expected
         */
        public function testResultFormat( array $test, array $expected ) {
 
@@ -106,8 +82,7 @@
 
                $instance = $this->newInstance( $queryResult );
                $instance->setIsRawMode( $test['rawMode'] );
-               $instance->setFormat( $test['format'] );
-               $instance->doFormat();
+               $instance->runFormatter();
 
                $this->assertEquals( 'query', $instance->getType() );
                $this->assertEquals( $expected['result'], 
$instance->getResult() );
@@ -116,16 +91,9 @@
        }
 
        /**
-        * @test ApiQueryResultFormatter::doFormat
-        * @test ApiQueryResultFormatter::setIsRawMode
-        * @test ApiQueryResultFormatter::setFormat
-        * @test ApiQueryResultFormatter::getResult
         * @dataProvider errorDataProvider
         *
         * @since 1.9
-        *
-        * @param array $test
-        * @param array $expected
         */
        public function testErrorFormat( array $test, array $expected ) {
 
@@ -138,8 +106,7 @@
                $instance = $this->newInstance( $queryResult );
 
                $instance->setIsRawMode( $test['rawMode'] );
-               $instance->setFormat( $test['format'] );
-               $instance->doFormat();
+               $instance->runFormatter();
 
                $this->assertEquals( 'error', $instance->getType() );
                $this->assertEquals( $expected, $instance->getResult() );
@@ -147,11 +114,10 @@
        }
 
        /**
-        * Provides a query array and its expected printrequest array
-        *
         * @return array
         */
        public function resultDataProvider() {
+
                $result = array(
                        'results' => array(
                                'Foo' => array(
@@ -178,238 +144,203 @@
                        'meta' => array( 'count' => 5, 'offset' => 5, 
'_element' => 'meta' )
                );
 
-               return array(
+               $provider = array();
 
-                       // #0 Without further results
+               // #0 Without further results
+               $provider[] = array(
                        array(
-                               array(
-                                       'result'  => $result,
-                                       'rawMode' => false,
-                                       'format'  => 'lala',
-                                       'furtherResults' => false
-                               ),
-                               array(
-                                       'result' => $result,
-                                       'continueOffset' => false
-                               )
+                               'result'  => $result,
+                               'rawMode' => false,
+                               'furtherResults' => false
                        ),
-
-                       // #1 Without further results + XML
                        array(
-                               array(
-                                       'result'  => $result,
-                                       'rawMode' => true,
-                                       'format'  => 'XML',
-                                       'furtherResults' => false
-                               ),
-                               array(
-                                       'result' => $xml,
-                                       'continueOffset' => false
-                               )
-                       ),
-
-                       // #2 With further results
-                       array(
-                               array(
-                                       'result' => $result,
-                                       'rawMode' => false,
-                                       'format'  => 'lala',
-                                       'furtherResults' => true
-                               ),
-                               array(
-                                       'result' => $result,
-                                       'continueOffset' => 10
-                               )
-                       ),
-
-                       // #3 With further results + XML
-                       array(
-                               array(
-                                       'result' => $result,
-                                       'rawMode' => true,
-                                       'format'  => 'XML',
-                                       'furtherResults' => true
-                               ),
-                               array(
-                                       'result' => $xml,
-                                       'continueOffset' => 10
-                               )
-                       ),
-
-                       // #4 Extended subject data + XML
-                       array(
-                               array(
-
-                                       'result' => array(
-                                               'results' => array(
-                                                       'Foo' => array(
-                                                               'printouts' => 
array(
-                                                                       'lula' 
=> array( 'lila' ) ),
-                                                               'fulltext' => 
'Foo' )
-                                                       ),
-                                               'printrequests' => array( 'Bar' 
),
-                                               'meta' => array(
-                                                       'count' => 5,
-                                                       'offset' => 5
-                                               )
-                                       ),
-                                       'rawMode' => true,
-                                       'format'  => 'XML',
-                                       'furtherResults' => true
-                               ),
-                               array(
-                                       'result' =>  array(
-                                               'results' => array(
-                                                       array(
-                                                               'printouts' => 
array(
-                                                                       array(
-                                                                               
'label' => 'lula',
-                                                                               
'lila', '_element' => 'value'
-                                                                       ), 
'_element' => 'property' ),
-                                                               'fulltext' => 
'Foo'
-                                                               ), '_element' 
=> 'subject'
-                                                       ),
-                                               'printrequests' => array( 
'Bar', '_element' => 'printrequest' ),
-                                               'meta' => array(
-                                                       'count' => 5,
-                                                       'offset' => 5,
-                                                       '_element' => 'meta'
-                                               )
-                                       ),
-                                       'continueOffset' => 10
-                               )
-                       ),
-
-                       // #5 printouts without values + XML
-                       array(
-                               array(
-
-                                       'result' => array(
-                                               'results' => array(
-                                                       'Foo' => array(
-                                                               'printouts' => 
array( 'lula' ),
-                                                               'fulltext' => 
'Foo' )
-                                                       ),
-                                               'printrequests' => array( 'Bar' 
),
-                                               'meta' => array(
-                                                       'count' => 5,
-                                                       'offset' => 5
-                                               )
-                                       ),
-                                       'rawMode' => true,
-                                       'format'  => 'XML',
-                                       'furtherResults' => true
-                               ),
-                               array(
-                                       'result' =>  array(
-                                               'results' => array(
-                                                       array(
-                                                               'printouts' => 
array( '_element' => 'property' ),
-                                                               'fulltext' => 
'Foo'
-                                                               ),
-                                                       '_element' => 'subject'
-                                                       ),
-                                               'printrequests' => array( 
'Bar', '_element' => 'printrequest' ),
-                                               'meta' => array(
-                                                       'count' => 5,
-                                                       'offset' => 5,
-                                                       '_element' => 'meta'
-                                               )
-                                       ),
-                                       'continueOffset' => 10
-                               )
-                       ),
-
-                       // #6 empty results + XML
-                       array(
-                               array(
-
-                                       'result' => array(
-                                               'results' => array(),
-                                               'printrequests' => array( 'Bar' 
),
-                                               'meta' => array(
-                                                       'count' => 0,
-                                                       'offset' => 0
-                                               )
-                                       ),
-                                       'rawMode' => true,
-                                       'format'  => 'XML',
-                                       'furtherResults' => false
-                               ),
-                               array(
-                                       'result' =>  array(
-                                               'results' => array(),
-                                               'printrequests' => array( 
'Bar', '_element' => 'printrequest' ),
-                                               'meta' => array(
-                                                       'count' => 0,
-                                                       'offset' => 0,
-                                                       '_element' => 'meta'
-                                               )
-                                       ),
-                                       'continueOffset' => 0
-                               )
+                               'result' => $result,
+                               'continueOffset' => false
                        )
-
                );
+
+               // #1 Without further results + XML
+               $provider[] = array(
+                       array(
+                               'result'  => $result,
+                               'rawMode' => true,
+                               'furtherResults' => false
+                       ),
+                       array(
+                               'result' => $xml,
+                               'continueOffset' => false
+                       )
+               );
+
+               // #2 With further results
+               $provider[] = array(
+                       array(
+                               'result' => $result,
+                               'rawMode' => false,
+                               'furtherResults' => true
+                       ),
+                       array(
+                               'result' => $result,
+                               'continueOffset' => 10
+                       )
+               );
+
+               // #3 With further results + XML
+               $provider[] = array(
+                       array(
+                               'result' => $result,
+                               'rawMode' => true,
+                               'furtherResults' => true
+                       ),
+                       array(
+                               'result' => $xml,
+                               'continueOffset' => 10
+                       )
+               );
+
+
+               // #4 Extended subject data + XML
+               $provider[] = array(
+                       array(
+                               'result' => array(
+                                       'results' => array(
+                                               'Foo' => array(
+                                                       'printouts' => array(
+                                                               'lula' => 
array( 'lila' ) ),
+                                                       'fulltext' => 'Foo' )
+                                               ),
+                                       'printrequests' => array( 'Bar' ),
+                                       'meta' => array(
+                                               'count' => 5,
+                                               'offset' => 5
+                                       )
+                               ),
+                               'rawMode' => true,
+                               'furtherResults' => true
+                       ),
+                       array(
+                               'result' =>  array(
+                                       'results' => array(
+                                               array(
+                                                       'printouts' => array(
+                                                               array(
+                                                                       'label' 
=> 'lula',
+                                                                       'lila', 
'_element' => 'value'
+                                                               ), '_element' 
=> 'property' ),
+                                                       'fulltext' => 'Foo'
+                                                       ), '_element' => 
'subject'
+                                               ),
+                                       'printrequests' => array( 'Bar', 
'_element' => 'printrequest' ),
+                                       'meta' => array(
+                                               'count' => 5,
+                                               'offset' => 5,
+                                               '_element' => 'meta'
+                                       )
+                               ),
+                               'continueOffset' => 10
+                       )
+               );
+
+               // #5 printouts without values + XML
+               $provider[] = array(
+                       array(
+                               'result' => array(
+                                       'results' => array(
+                                               'Foo' => array(
+                                                       'printouts' => array( 
'lula' ),
+                                                       'fulltext' => 'Foo' )
+                                               ),
+                                       'printrequests' => array( 'Bar' ),
+                                       'meta' => array(
+                                               'count' => 5,
+                                               'offset' => 5
+                                       )
+                               ),
+                               'rawMode' => true,
+                               'furtherResults' => true
+                       ),
+                       array(
+                               'result' =>  array(
+                                       'results' => array(
+                                               array(
+                                                       'printouts' => array( 
'_element' => 'property' ),
+                                                       'fulltext' => 'Foo'
+                                                       ),
+                                               '_element' => 'subject'
+                                               ),
+                                       'printrequests' => array( 'Bar', 
'_element' => 'printrequest' ),
+                                       'meta' => array(
+                                               'count' => 5,
+                                               'offset' => 5,
+                                               '_element' => 'meta'
+                                       )
+                               ),
+                               'continueOffset' => 10
+                       )
+               );
+
+               // #6 empty results + XML
+               $provider[] = array(
+                       array(
+                               'result' => array(
+                                       'results' => array(),
+                                       'printrequests' => array( 'Bar' ),
+                                       'meta' => array(
+                                               'count' => 0,
+                                               'offset' => 0
+                                       )
+                               ),
+                               'rawMode' => true,
+                               'furtherResults' => false
+                       ),
+                       array(
+                               'result' =>  array(
+                                       'results' => array(),
+                                       'printrequests' => array( 'Bar', 
'_element' => 'printrequest' ),
+                                       'meta' => array(
+                                               'count' => 0,
+                                               'offset' => 0,
+                                               '_element' => 'meta'
+                                       )
+                               ),
+                               'continueOffset' => 0
+                       )
+               );
+
+               return $provider;
        }
 
        /**
-        * Provides error samples
-        *
         * @return array
         */
        public function errorDataProvider() {
+
                $errors = array( 'Foo', 'Bar' );
 
-               return array(
+               $provider = array();
 
-                       // #0
+               // #0
+               $provider[] = array(
                        array(
-                               array(
-                                       'rawMode'=> false,
-                                       'format' => 'lala',
-                                       'errors' => $errors
-                               ),
-                               array(
-                                       'query' => $errors
-                               )
+                               'rawMode'=> false,
+                               'errors' => $errors
                        ),
-
-                       // #1
                        array(
-                               array(
-                                       'rawMode'=> true,
-                                       'format' => 'lala',
-                                       'errors' => $errors
-                               ),
-                               array(
-                                       'query' => $errors
-                               )
-                       ),
-
-                       // #2
-                       array(
-                               array(
-                                       'rawMode'=> false,
-                                       'format' => 'XML',
-                                       'errors' => $errors
-                               ),
-                               array(
-                                       'query' => $errors
-                               )
-                       ),
-
-                       // #3
-                       array(
-                               array(
-                                       'rawMode'=> true,
-                                       'format' => 'XML',
-                                       'errors' => $errors
-                               ),
-                               array(
-                                       'query' => array_merge( $errors, array( 
'_element' => 'info' ) )
-                               )
+                               'query' => $errors
                        )
                );
+
+               // #1
+               $provider[] = array(
+                       array(
+                               'rawMode'=> true,
+                               'errors' => $errors
+                       ),
+                       array(
+                               'query' => array_merge( $errors, array( 
'_element' => 'info' ) )
+                       )
+               );
+
+               return $provider;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/91042
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d601a6f861642f5863cf1742d648488fd735c83
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to