Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / api / format / ApiFormatJsonTest.php
blobbdf3f139478c63b10afe7bc6e30eecf3bec03591
1 <?php
3 /**
4 * @group API
5 * @covers ApiFormatJson
6 */
7 class ApiFormatJsonTest extends ApiFormatTestBase {
9 protected $printerName = 'json';
11 public static function provideGeneralEncoding() {
12 return array(
13 // Basic types
14 array( array( null ), '[null]' ),
15 array( array( true ), '[true]' ),
16 array( array( false ), '[false]' ),
17 array( array( 42 ), '[42]' ),
18 array( array( 42.5 ), '[42.5]' ),
19 array( array( 1e42 ), '[1.0e+42]' ),
20 array( array( 'foo' ), '["foo"]' ),
21 array( array( 'fóo' ), '["f\u00f3o"]' ),
22 array( array( 'fóo' ), '["fóo"]', array( 'utf8' => 1 ) ),
24 // Arrays and objects
25 array( array( array() ), '[[]]' ),
26 array( array( array( 1 ) ), '[[1]]' ),
27 array( array( array( 'x' => 1 ) ), '[{"x":1}]' ),
28 array( array( array( 2 => 1 ) ), '[{"2":1}]' ),
29 array( array( (object)array() ), '[{}]' ),
31 // Content
32 array( array( '*' => 'foo' ), '{"*":"foo"}' ),
34 // Callbacks
35 array( array( 1 ), '/**/myCallback([1])', array( 'callback' => 'myCallback' ) ),
37 // Cross-domain mangling
38 array( array( '< Cross-Domain-Policy >' ), '["\u003C Cross-Domain-Policy \u003E"]' ),