c00545f8ebe032a3047aaafde46f240d3b428a52
[lhc/web/wiklou.git] / tests / phpunit / includes / api / format / ApiFormatWddxTest.php
1 <?php
2
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 * @covers ApiFormatWddx
8 */
9 class ApiFormatWddxTest extends ApiFormatTestBase {
10
11 public function testValidSyntax( ) {
12 if ( !function_exists( 'wddx_deserialize' ) ) {
13 $this->markTestSkipped( "Function 'wddx_deserialize' not exist, skipping." );
14 }
15
16 if ( wfIsHHVM() && false === strpos( wddx_serialize_value( "Test for &" ), '&amp;' ) ) {
17 # Some version of HHVM fails to escape the ampersand
18 #
19 # https://phabricator.wikimedia.org/T75531
20 $this->markTestSkipped( "wddx_deserialize is bugged under this version of HHVM" );
21 }
22
23 $data = $this->apiRequest( 'wddx', array( 'action' => 'query', 'meta' => 'siteinfo' ) );
24
25 $this->assertInternalType( 'array', wddx_deserialize( $data ) );
26 $this->assertGreaterThan( 0, count( (array)$data ) );
27 }
28 }