From: addshore Date: Wed, 23 Oct 2013 15:10:02 +0000 (+0100) Subject: Add more ApiFormat format tests X-Git-Tag: 1.31.0-rc.0~18407^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=95779682802ed1bc3ae7bb289ab906c04d7b405a;p=lhc%2Fweb%2Fwiklou.git Add more ApiFormat format tests Adds tests for Json and wddx formats Add @covers tags Fixes some comments Fixes scope Change-Id: I5f22097ddcaeb917f856ba7aa0cb793caa17925e --- diff --git a/tests/phpunit/includes/api/format/ApiFormatJsonTest.php b/tests/phpunit/includes/api/format/ApiFormatJsonTest.php new file mode 100644 index 0000000000..c71faec8e2 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatJsonTest.php @@ -0,0 +1,17 @@ +apiRequest( 'json', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); + + $this->assertInternalType( 'array', json_decode( $data, true ) ); + $this->assertGreaterThan( 0, count( (array)$data ) ); + } +} diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index a0bbb2dc7d..759dfc71d0 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -4,11 +4,11 @@ * @group API * @group Database * @group medium + * @covers ApiFormatPhp */ class ApiFormatPhpTest extends ApiFormatTestBase { - public function testValidPhpSyntax() { - + public function testValidyntax( ) { $data = $this->apiRequest( 'php', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); $this->assertInternalType( 'array', unserialize( $data ) ); diff --git a/tests/phpunit/includes/api/format/ApiFormatTestBase.php b/tests/phpunit/includes/api/format/ApiFormatTestBase.php index 153f2cf46d..24d8cb8a2b 100644 --- a/tests/phpunit/includes/api/format/ApiFormatTestBase.php +++ b/tests/phpunit/includes/api/format/ApiFormatTestBase.php @@ -1,9 +1,18 @@ createPrinterByName( $format ); @@ -19,4 +28,5 @@ abstract class ApiFormatTestBase extends ApiTestCase { return $out; } + } diff --git a/tests/phpunit/includes/api/format/ApiFormatWddxTest.php b/tests/phpunit/includes/api/format/ApiFormatWddxTest.php new file mode 100644 index 0000000000..2cf6dcafb4 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatWddxTest.php @@ -0,0 +1,17 @@ +apiRequest( 'wddx', array( 'action' => 'query', 'meta' => 'siteinfo' ) ); + + $this->assertInternalType( 'array', wddx_deserialize( $data ) ); + $this->assertGreaterThan( 0, count( (array)$data ) ); + } +}