Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / api / format / ApiFormatDumpTest.php
blob2800d2dfb6b8eacdd0f5060a38243cd4411b9e99
1 <?php
3 /**
4 * @group API
5 * @covers ApiFormatDump
6 */
7 class ApiFormatDumpTest extends ApiFormatTestBase {
9 protected $printerName = 'dump';
11 public static function provideGeneralEncoding() {
12 // Sigh. Docs claim it's a boolean, but can have values 0, 1, or 2.
13 // Fortunately wfIniGetBool does the right thing.
14 if ( wfIniGetBool( 'xdebug.overload_var_dump' ) ) {
15 return array(
16 array( array(), 'Cannot test ApiFormatDump when xDebug overloads var_dump', array( 'SKIP' => true ) ),
20 $warning = "\n [\"warnings\"]=>\n array(1) {\n [\"dump\"]=>\n array(1) {\n [\"*\"]=>\n" .
21 " string(64) \"format=dump has been deprecated. Please use format=json instead.\"\n" .
22 " }\n }";
24 return array(
25 // Basic types
26 array( array( null ), "array(2) {{$warning}\n [0]=>\n NULL\n}\n" ),
27 array( array( true ), "array(2) {{$warning}\n [0]=>\n bool(true)\n}\n" ),
28 array( array( false ), "array(2) {{$warning}\n [0]=>\n bool(false)\n}\n" ),
29 array( array( 42 ), "array(2) {{$warning}\n [0]=>\n int(42)\n}\n" ),
30 array( array( 42.5 ), "array(2) {{$warning}\n [0]=>\n float(42.5)\n}\n" ),
31 array( array( 1e42 ), "array(2) {{$warning}\n [0]=>\n float(1.0E+42)\n}\n" ),
32 array( array( 'foo' ), "array(2) {{$warning}\n [0]=>\n string(3) \"foo\"\n}\n" ),
33 array( array( 'fóo' ), "array(2) {{$warning}\n [0]=>\n string(4) \"fóo\"\n}\n" ),
35 // Arrays
36 array( array( array() ), "array(2) {{$warning}\n [0]=>\n array(0) {\n }\n}\n" ),
37 array( array( array( 1 ) ), "array(2) {{$warning}\n [0]=>\n array(1) {\n [0]=>\n int(1)\n }\n}\n" ),
38 array( array( array( 'x' => 1 ) ), "array(2) {{$warning}\n [0]=>\n array(1) {\n [\"x\"]=>\n int(1)\n }\n}\n" ),
39 array( array( array( 2 => 1 ) ), "array(2) {{$warning}\n [0]=>\n array(1) {\n [2]=>\n int(1)\n }\n}\n" ),
41 // Content
42 array( array( '*' => 'foo' ), "array(2) {{$warning}\n [\"*\"]=>\n string(3) \"foo\"\n}\n" ),