createResourceLoaderContext(); $this->assertSame( 've.ui.mwCitationTools = [{"name":"n","title":"t"}];', CitationToolDefinition::makeScript( $context ) ); } private function createResourceLoaderContext(): Context { $msg = $this->createMock( Message::class ); $msg->method( 'inContentLanguage' ) ->willReturnSelf(); $msg->method( 'plain' ) ->willReturnOnConsecutiveCalls( '', '[{"name":"n"}]' ); $msg->method( 'text' ) ->willReturn( 't' ); $context = $this->createStub( Context::class ); $context->method( 'msg' ) ->willReturnMap( [ [ 'cite-tool-definition.json', $msg ], [ 'visualeditor-cite-tool-definition.json', $msg ], [ 'visualeditor-cite-tool-name-n', $msg ] ] ); $context->method( 'encodeJson' )->willReturnCallback( 'json_encode' ); return $context; } }