Finish FormatJson::encode() test coverage
authorKunal Mehta <legoktm@member.fsf.org>
Sun, 3 Feb 2019 05:42:31 +0000 (21:42 -0800)
committerKunal Mehta <legoktm@member.fsf.org>
Sun, 3 Feb 2019 06:04:35 +0000 (22:04 -0800)
Change-Id: I3aced17da653216de2092e1d7986748c271c5b82

tests/phpunit/includes/json/FormatJsonTest.php

index 2760cb9..a6adf34 100644 (file)
@@ -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',