diff options
author | Brad Jorsch <bjorsch@wikimedia.org> | 2018-12-20 09:59:02 -0500 |
---|---|---|
committer | Brad Jorsch <bjorsch@wikimedia.org> | 2018-12-20 10:03:26 -0500 |
commit | db67de7fad899de33d4c8e3b6ee8189f8570d826 (patch) | |
tree | 9de29f4bab6d3cf95ed3ebdf9e08b5f3463429ee /tests/phpunit/includes/api/ApiErrorFormatterTest.php | |
parent | f2d4db9d03a984d998db9044e63e548597511eb6 (diff) | |
download | mediawikicore-db67de7fad899de33d4c8e3b6ee8189f8570d826.tar.gz mediawikicore-db67de7fad899de33d4c8e3b6ee8189f8570d826.zip |
ApiDelete: Handle batched deletions properly
When batched deletions via the job queue were added in Ie800fb5a, the
way this was reported caused ApiDelete to report an error. Instead it
should report success with appropriate signaling to the client.
Bug: T212356
Change-Id: I1ef66277e988572c6720cf3e3cb36b18530746b4
Diffstat (limited to 'tests/phpunit/includes/api/ApiErrorFormatterTest.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiErrorFormatterTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/phpunit/includes/api/ApiErrorFormatterTest.php b/tests/phpunit/includes/api/ApiErrorFormatterTest.php index 312ef55e8fa4..d7628e0ccf75 100644 --- a/tests/phpunit/includes/api/ApiErrorFormatterTest.php +++ b/tests/phpunit/includes/api/ApiErrorFormatterTest.php @@ -634,6 +634,40 @@ class ApiErrorFormatterTest extends MediaWikiLangTestCase { ]; } + public function testAddMessagesFromStatus_filter() { + $result = new ApiResult( 8388608 ); + $formatter = new ApiErrorFormatter( $result, Language::factory( 'qqx' ), 'plaintext', false ); + + $status = Status::newGood(); + $status->warning( 'mainpage' ); + $status->warning( 'parentheses', 'foobar' ); + $status->warning( wfMessage( 'mainpage' ) ); + $status->error( 'mainpage' ); + $status->error( 'parentheses', 'foobaz' ); + $formatter->addMessagesFromStatus( 'status', $status, [ 'warning', 'error' ], [ 'mainpage' ] ); + $this->assertSame( [ + 'errors' => [ + [ + 'code' => 'parentheses', + 'text' => '(parentheses: foobaz)', + 'module' => 'status', + ApiResult::META_CONTENT => 'text', + ], + ApiResult::META_INDEXED_TAG_NAME => 'error', + ], + 'warnings' => [ + [ + 'code' => 'parentheses', + 'text' => '(parentheses: foobar)', + 'module' => 'status', + ApiResult::META_CONTENT => 'text', + ], + ApiResult::META_INDEXED_TAG_NAME => 'warning', + ], + ApiResult::META_TYPE => 'assoc', + ], $result->getResultData() ); + } + /** * @dataProvider provideIsValidApiCode * @covers ApiErrorFormatter::isValidApiCode |