aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiResultTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/api/ApiResultTest.php')
-rw-r--r--tests/phpunit/includes/api/ApiResultTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/phpunit/includes/api/ApiResultTest.php b/tests/phpunit/includes/api/ApiResultTest.php
index 9dbde3d93fa1..292d276b681f 100644
--- a/tests/phpunit/includes/api/ApiResultTest.php
+++ b/tests/phpunit/includes/api/ApiResultTest.php
@@ -218,6 +218,17 @@ class ApiResultTest extends MediaWikiTestCase {
0 => "foo\xef\xbf\xbdbar",
1 => "\xc3\xa1",
), $arr );
+
+ $obj = new stdClass;
+ $obj->{'1'} = 'one';
+ $arr = array();
+ ApiResult::setValue( $arr, 'foo', $obj );
+ $this->assertSame( array(
+ 'foo' => array(
+ 1 => 'one',
+ ApiResult::META_TYPE => 'assoc',
+ )
+ ), $arr );
}
/**
@@ -509,6 +520,19 @@ class ApiResultTest extends MediaWikiTestCase {
1 => "\xc3\xa1",
ApiResult::META_TYPE => 'assoc',
), $result->getResultData() );
+
+ $result = new ApiResult( 8388608 );
+ $obj = new stdClass;
+ $obj->{'1'} = 'one';
+ $arr = array();
+ $result->addValue( $arr, 'foo', $obj );
+ $this->assertSame( array(
+ 'foo' => array(
+ 1 => 'one',
+ ApiResult::META_TYPE => 'assoc',
+ ),
+ ApiResult::META_TYPE => 'assoc',
+ ), $result->getResultData() );
}
/**