MediaWiki REL1_31
ApiFormatNoneTest.php
Go to the documentation of this file.
1<?php
2
8
9 protected $printerName = 'none';
10
11 public static function provideGeneralEncoding() {
12 return [
13 // Basic types
14 [ [ null ], '' ],
15 [ [ true ], '' ],
16 [ [ false ], '' ],
17 [ [ 42 ], '' ],
18 [ [ 42.5 ], '' ],
19 [ [ 1e42 ], '' ],
20 [ [ 'foo' ], '' ],
21 [ [ 'fóo' ], '' ],
22
23 // Arrays and objects
24 [ [ [] ], '' ],
25 [ [ [ 1 ] ], '' ],
26 [ [ [ 'x' => 1 ] ], '' ],
27 [ [ [ 2 => 1 ] ], '' ],
28 [ [ (object)[] ], '' ],
29 [ [ [ 1, ApiResult::META_TYPE => 'assoc' ] ], '' ],
30 [ [ [ 'x' => 1, ApiResult::META_TYPE => 'array' ] ], '' ],
31 [ [ [ 'x' => 1, ApiResult::META_TYPE => 'kvp' ] ], '' ],
32 [
33 [ [
34 'x' => 1,
35 ApiResult::META_TYPE => 'BCkvp',
37 ] ],
38 ''
39 ],
40 [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCarray' ] ], '' ],
41 [ [ [ 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ] ], '' ],
42
43 // Content
44 [ [ '*' => 'foo' ], '' ],
45
46 // BC Subelements
47 [ [ 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => [ 'foo' ] ], '' ],
48 ];
49 }
50
51}
API ApiFormatNone.
static provideGeneralEncoding()
Return general data to be encoded for testing.
const META_TYPE
Key for the 'type' metadata item.
const META_KVP_KEY_NAME
Key for the metadata item whose value specifies the name used for the kvp key in the alternative outp...
const META_BC_SUBELEMENTS
Key for the 'BC subelements' metadata item.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition hooks.txt:2006
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
Definition globals.txt:64