MediaWiki
REL1_24
|
00001 <?php 00002 00009 class ApiFormatJsonTest extends ApiFormatTestBase { 00010 00011 public function testValidSyntax( ) { 00012 $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); 00013 00014 $this->assertInternalType( 'array', json_decode( $data, true ) ); 00015 $this->assertGreaterThan( 0, count( (array)$data ) ); 00016 } 00017 00018 public function testJsonpInjection( ) { 00019 $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo', 'callback' => 'myCallback' ) ); 00020 $this->assertEquals( '/**/myCallback(', substr( $data, 0, 15 ) ); 00021 } 00022 }