Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / mocks / content / DummyContentHandlerForTesting.php
bloba45c5543b0e38ab0b23f979f35387303301424d0
1 <?php
3 use MediaWiki\Content\Content;
4 use MediaWiki\Content\ContentHandler;
5 use MediaWiki\Content\Renderer\ContentParseParams;
6 use MediaWiki\Parser\ParserOutput;
8 class DummyContentHandlerForTesting extends ContentHandler {
10 public function __construct( $dataModel, $formats = [ DummyContentForTesting::MODEL_ID ] ) {
11 parent::__construct( $dataModel, $formats );
14 protected function getContentClass() {
15 return DummyContentForTesting::class;
18 /**
19 * @see ContentHandler::serializeContent
21 * @param Content $content
22 * @param string|null $format
24 * @return string
26 public function serializeContent( Content $content, $format = null ) {
27 return $content->serialize();
30 /**
31 * @see ContentHandler::unserializeContent
33 * @param string $blob
34 * @param string|null $format Unused.
36 * @return Content
38 public function unserializeContent( $blob, $format = null ) {
39 return new DummyContentForTesting( $blob );
42 /**
43 * Creates an empty Content object of the type supported by this ContentHandler.
44 * @return DummyContentForTesting
46 public function makeEmptyContent() {
47 return new DummyContentForTesting( '' );
50 public function generateHTMLOnEdit(): bool {
51 return false;
54 /**
55 * @see ContentHandler::fillParserOutput()
57 * @since 1.38
58 * @param Content $content
59 * @param ContentParseParams $cpoParams
60 * @param ParserOutput &$output The output object to fill (reference).
62 protected function fillParserOutput(
63 Content $content,
64 ContentParseParams $cpoParams,
65 ParserOutput &$output
66 ) {
67 '@phan-var DummyContentForTesting $content';
68 $output = new ParserOutput( $content->getNativeData() );