Merge "API: i18n for warnings and errors"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / format / ApiFormatNoneTest.php
index cabd750..87e3670 100644 (file)
@@ -2,15 +2,50 @@
 
 /**
  * @group API
- * @group Database
- * @group medium
  * @covers ApiFormatNone
  */
 class ApiFormatNoneTest extends ApiFormatTestBase {
 
-       public function testValidSyntax( ) {
-               $data = $this->apiRequest( 'none', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
+       protected $printerName = 'none';
 
-               $this->assertEquals( '', $data ); // No output!
+       public static function provideGeneralEncoding() {
+               return [
+                       // Basic types
+                       [ [ null ], '' ],
+                       [ [ true ], '' ],
+                       [ [ false ], '' ],
+                       [ [ 42 ], '' ],
+                       [ [ 42.5 ], '' ],
+                       [ [ 1e42 ], '' ],
+                       [ [ 'foo' ], '' ],
+                       [ [ 'fóo' ], '' ],
+
+                       // Arrays and objects
+                       [ [ [] ], '' ],
+                       [ [ [ 1 ] ], '' ],
+                       [ [ [ 'x' => 1 ] ], '' ],
+                       [ [ [ 2 => 1 ] ], '' ],
+                       [ [ (object)[] ], '' ],
+                       [ [ [ 1, ApiResult::META_TYPE => 'assoc' ] ], '' ],
+                       [ [ [ 'x' => 1, ApiResult::META_TYPE => 'array' ] ], '' ],
+                       [ [ [ 'x' => 1, ApiResult::META_TYPE => 'kvp' ] ], '' ],
+                       [
+                               [ [
+                                       'x' => 1,
+                                       ApiResult::META_TYPE => 'BCkvp',
+                                       ApiResult::META_KVP_KEY_NAME => 'key'
+                               ] ],
+                               ''
+                       ],
+                       [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCarray' ] ], '' ],
+                       [ [ [ 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ] ], '' ],
+
+                       // Content
+                       [ [ '*' => 'foo' ], '' ],
+
+                       // BC Subelements
+                       [ [ 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => [ 'foo' ] ], '' ],
+               ];
        }
+
 }