5 * @covers ApiFormatJson
7 class ApiFormatJsonTest
extends ApiFormatTestBase
{
9 protected $printerName = 'json';
11 public static function provideGeneralEncoding() {
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 ) ),
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() ), '[{}]' ),
32 array( array( '*' => 'foo' ), '{"*":"foo"}' ),
35 array( array( 1 ), '/**/myCallback([1])', array( 'callback' => 'myCallback' ) ),
37 // Cross-domain mangling
38 array( array( '< Cross-Domain-Policy >' ), '["\u003C Cross-Domain-Policy \u003E"]' ),