Merge "Change message on Special:Wantedfiles based on if foreign repo on."
[lhc/web/wiklou.git] / tests / phpunit / includes / api / query / ApiQueryBasicTest.php
index a68c830..e486c4f 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 /**
- *
  *
  * Created on Feb 6, 2013
  *
@@ -35,6 +34,8 @@ require_once 'ApiQueryTestBase.php';
  * @covers ApiQuery
  */
 class ApiQueryBasicTest extends ApiQueryTestBase {
+       protected $exceptionFromAddDBData;
+
        /**
         * Create a set of pages. These must not change, otherwise the tests might give wrong results.
         * @see MediaWikiTestCase::addDBData()
@@ -130,6 +131,7 @@ class ApiQueryBasicTest extends ApiQueryTestBase {
                ) )
        );
 
+       // Although this appears to have no use it is used by testLists()
        private static $allcategories = array(
                array( 'list' => 'allcategories', 'acprefix' => 'AQBT-' ),
                array( 'allcategories' => array(
@@ -236,6 +238,7 @@ class ApiQueryBasicTest extends ApiQueryTestBase {
                $this->check( self::$alllinks );
                $this->check( self::$alltransclusions );
                // This test is temporarily disabled until a sqlite bug is fixed
+               // Confirmed still broken 15-nov-2013
                // $this->check( self::$allcategories );
                $this->check( self::$backlinks );
                $this->check( self::$embeddedin );
@@ -347,51 +350,4 @@ class ApiQueryBasicTest extends ApiQueryTestBase {
                        )
                ) );
        }
-
-       /**
-        * Recursively merges the expected values in the $item into the $all
-        */
-       private function mergeExpected( &$all, $item ) {
-               foreach ( $item as $k => $v ) {
-                       if ( array_key_exists( $k, $all ) ) {
-                               if ( is_array( $all[$k] ) ) {
-                                       $this->mergeExpected( $all[$k], $v );
-                               } else {
-                                       $this->assertEquals( $all[$k], $v );
-                               }
-                       } else {
-                               $all[$k] = $v;
-                       }
-               }
-       }
-
-       /**
-        * Recursively compare arrays, ignoring mismatches in numeric key and pageids.
-        * @param $expected array expected values
-        * @param $result array returned values
-        */
-       private function assertQueryResults( $expected, $result ) {
-               reset( $expected );
-               reset( $result );
-               while ( true ) {
-                       $e = each( $expected );
-                       $r = each( $result );
-                       // If either of the arrays is shorter, abort. If both are done, success.
-                       $this->assertEquals( (bool)$e, (bool)$r );
-                       if ( !$e ) {
-                               break; // done
-                       }
-                       // continue only if keys are identical or both keys are numeric
-                       $this->assertTrue( $e['key'] === $r['key'] || ( is_numeric( $e['key'] ) && is_numeric( $r['key'] ) ) );
-                       // don't compare pageids
-                       if ( $e['key'] !== 'pageid' ) {
-                               // If values are arrays, compare recursively, otherwise compare with ===
-                               if ( is_array( $e['value'] ) && is_array( $r['value'] ) ) {
-                                       $this->assertQueryResults( $e['value'], $r['value'] );
-                               } else {
-                                       $this->assertEquals( $e['value'], $r['value'] );
-                               }
-                       }
-               }
-       }
 }