7 * @covers ApiFormatJson
9 class ApiFormatJsonTest
extends ApiFormatTestBase
{
11 public function testValidSyntax( ) {
12 $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
14 $this->assertInternalType( 'array', json_decode( $data, true ) );
15 $this->assertGreaterThan( 0, count( (array)$data ) );
18 public function testJsonpInjection( ) {
19 $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo', 'callback' => 'myCallback' ) );
20 $this->assertEquals( '/**/myCallback(', substr( $data, 0, 15 ) );