diff options
author | Brad Jorsch <bjorsch@wikimedia.org> | 2015-01-16 14:00:07 -0500 |
---|---|---|
committer | Brad Jorsch <bjorsch@wikimedia.org> | 2015-04-20 17:49:37 -0400 |
commit | beab6b009ef45d1d8e62943caa4bceb7a04f0c16 (patch) | |
tree | 600c4b865962317aac53a2fd9cf5bb333120b7e7 /tests/phpunit/includes/api/ApiErrorFormatterTest.php | |
parent | 6a9428babd1cd78b80fc6cca92e495cd444fc7d3 (diff) | |
download | mediawikicore-beab6b009ef45d1d8e62943caa4bceb7a04f0c16.tar.gz mediawikicore-beab6b009ef45d1d8e62943caa4bceb7a04f0c16.zip |
Change API result data structure to be cleaner in new formats
Nothing in this patch should result in changed output for format=json or
format=php except as noted in RELEASE-NOTES-1.25, and changed output for
format=xml should be similar or cosmetic. However, other code accessing
the result data directly may need to be updated.
Bug: T87053
Bug: T12887
Change-Id: I3500708965cb8869b5aed1543381aad208dadd13
Diffstat (limited to 'tests/phpunit/includes/api/ApiErrorFormatterTest.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiErrorFormatterTest.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/phpunit/includes/api/ApiErrorFormatterTest.php b/tests/phpunit/includes/api/ApiErrorFormatterTest.php index 344af62fddeb..8ebdf60f5f19 100644 --- a/tests/phpunit/includes/api/ApiErrorFormatterTest.php +++ b/tests/phpunit/includes/api/ApiErrorFormatterTest.php @@ -15,6 +15,11 @@ class ApiErrorFormatterTest extends MediaWikiTestCase { $result = new ApiResult( 8388608 ); $formatter = new ApiErrorFormatter( $result, Language::factory( $lang ), $format, $useDB ); + // Add default type + $expect1[ApiResult::META_TYPE] = 'assoc'; + $expect2[ApiResult::META_TYPE] = 'assoc'; + $expect3[ApiResult::META_TYPE] = 'assoc'; + $formatter->addWarning( 'string', 'mainpage' ); $formatter->addError( 'err', 'mainpage' ); $this->assertSame( $expect1, $result->getResultData(), 'Simple test' ); @@ -262,6 +267,7 @@ class ApiErrorFormatterTest extends MediaWikiTestCase { ApiResult::META_CONTENT => 'warnings', ), ), + ApiResult::META_TYPE => 'assoc', ), $result->getResultData(), 'Simple test' ); $result->reset(); @@ -293,6 +299,7 @@ class ApiErrorFormatterTest extends MediaWikiTestCase { ApiResult::META_CONTENT => 'warnings', ), ), + ApiResult::META_TYPE => 'assoc', ), $result->getResultData(), 'Complex test' ); $result->reset(); @@ -315,6 +322,7 @@ class ApiErrorFormatterTest extends MediaWikiTestCase { ApiResult::META_CONTENT => 'warnings', ), ), + ApiResult::META_TYPE => 'assoc', ), $result->getResultData(), 'Status test' ); $I = ApiResult::META_INDEXED_TAG_NAME; |