Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / content / DummyNonTextContentHandler.php
blobfce7f43b288c8585afd720945e2acf57c4459e02
1 <?php
3 use MediaWiki\Content\Content;
4 use MediaWiki\Content\Renderer\ContentParseParams;
5 use MediaWiki\Parser\ParserOutput;
7 class DummyNonTextContentHandler extends DummyContentHandlerForTesting {
9 public function __construct( $dataModel ) {
10 parent::__construct( $dataModel, [ "testing-nontext" ] );
13 /**
14 * @see ContentHandler::serializeContent
16 * @param Content $content
17 * @param string|null $format
19 * @return string
21 public function serializeContent( Content $content, $format = null ) {
22 return $content->serialize();
25 /**
26 * @see ContentHandler::unserializeContent
28 * @param string $blob
29 * @param string|null $format Unused.
31 * @return Content
33 public function unserializeContent( $blob, $format = null ) {
34 return new DummyNonTextContent( $blob );
37 /**
38 * Creates an empty Content object of the type supported by this ContentHandler.
39 * @return DummyNonTextContent
41 public function makeEmptyContent() {
42 return new DummyNonTextContent( '' );
45 public function supportsDirectApiEditing() {
46 return true;
49 /**
50 * @see ContentHandler::fillParserOutput()
52 * @since 1.38
53 * @param Content $content
54 * @param ContentParseParams $cpoParams
55 * @param ParserOutput &$output The output object to fill (reference).
57 protected function fillParserOutput(
58 Content $content,
59 ContentParseParams $cpoParams,
60 ParserOutput &$output
61 ) {
62 '@phan-var DummyNonTextContent $content';
63 $output = new ParserOutput( $content->serialize() );