From: Kunal Mehta Date: Sun, 3 Feb 2019 05:42:31 +0000 (-0800) Subject: Finish FormatJson::encode() test coverage X-Git-Tag: 1.34.0-rc.0~2958 X-Git-Url: http://git.cyclocoop.org/%27http:/code.google.com/p/ie7-js/Category:Bar2?a=commitdiff_plain;h=ca31b7f793df5ef6d1fc31b4a43c88313067b619;p=lhc%2Fweb%2Fwiklou.git Finish FormatJson::encode() test coverage Change-Id: I3aced17da653216de2092e1d7986748c271c5b82 --- diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/includes/json/FormatJsonTest.php index 2760cb9f22..a6adf343d5 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',