The default TextContentHandler::makeEmptyContent() implementation
is an empty string, which is not valid JSON.
Change-Id: I8bc6ec647c5e8cd01c5cd63031525619c4ef44d0
protected function getContentClass() {
return JsonContent::class;
}
+
+ public function makeEmptyContent() {
+ $class = $this->getContentClass();
+ return new $class( '{}' );
+ }
}
--- /dev/null
+<?php
+
+class JsonContentHandlerTest extends MediaWikiTestCase {
+
+ /**
+ * @covers JsonContentHandler::makeEmptyContent
+ */
+ public function testMakeEmptyContent() {
+ $handler = new JsonContentHandler();
+ $content = $handler->makeEmptyContent();
+ $this->assertInstanceOf( JsonContent::class, $content );
+ $this->assertTrue( $content->isValid() );
+ }
+}