aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/json/FormatJsonTest.php
diff options
context:
space:
mode:
authorKunal Mehta <legoktm@member.fsf.org>2019-02-02 21:42:31 -0800
committerKunal Mehta <legoktm@member.fsf.org>2019-02-02 22:04:35 -0800
commitca31b7f793df5ef6d1fc31b4a43c88313067b619 (patch)
treefd6ec75c0bb6784f9fe7272e4273ebb730ce1a54 /tests/phpunit/includes/json/FormatJsonTest.php
parent47838dfd6d6f62ba5cc8b5f0140f325418eada3a (diff)
downloadmediawikicore-ca31b7f793df5ef6d1fc31b4a43c88313067b619.tar.gz
mediawikicore-ca31b7f793df5ef6d1fc31b4a43c88313067b619.zip
Finish FormatJson::encode() test coverage
Change-Id: I3aced17da653216de2092e1d7986748c271c5b82
Diffstat (limited to 'tests/phpunit/includes/json/FormatJsonTest.php')
-rw-r--r--tests/phpunit/includes/json/FormatJsonTest.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/includes/json/FormatJsonTest.php
index 2760cb9f2290..a6adf343d5af 100644
--- a/tests/phpunit/includes/json/FormatJsonTest.php
+++ b/tests/phpunit/includes/json/FormatJsonTest.php
@@ -109,6 +109,15 @@ class FormatJsonTest extends MediaWikiTestCase {
);
}
+ public function testEncodeFail() {
+ // Set up a recursive object that can't be encoded.
+ $a = new stdClass;
+ $b = new stdClass;
+ $a->b = $b;
+ $b->a = $a;
+ $this->assertFalse( FormatJson::encode( $a ) );
+ }
+
public function testDecodeReturnType() {
$this->assertInternalType(
'object',