From ca31b7f793df5ef6d1fc31b4a43c88313067b619 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 2 Feb 2019 21:42:31 -0800 Subject: [PATCH] Finish FormatJson::encode() test coverage Change-Id: I3aced17da653216de2092e1d7986748c271c5b82 --- tests/phpunit/includes/json/FormatJsonTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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', -- 2.20.1