From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- .../includes/api/format/ApiFormatJsonTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/phpunit/includes/api/format/ApiFormatJsonTest.php (limited to 'tests/phpunit/includes/api/format/ApiFormatJsonTest.php') diff --git a/tests/phpunit/includes/api/format/ApiFormatJsonTest.php b/tests/phpunit/includes/api/format/ApiFormatJsonTest.php new file mode 100644 index 00000000..fc1f9021 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatJsonTest.php @@ -0,0 +1,22 @@ +apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); + + $this->assertInternalType( 'array', json_decode( $data, true ) ); + $this->assertGreaterThan( 0, count( (array)$data ) ); + } + + public function testJsonpInjection( ) { + $data = $this->apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo', 'callback' => 'myCallback' ) ); + $this->assertEquals( '/**/myCallback(', substr( $data, 0, 15 ) ); + } +} -- cgit v1.2.3-54-g00ecf