| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\Content\Content; |
| 4 |
use MediaWiki\Content\ContentHandler; |
| 5 |
use MediaWiki\Content\Renderer\ContentParseParams; |
| 6 |
use MediaWiki\Parser\ParserOutput; |
| 7 |
|
| 8 |
class DummyContentHandlerForTesting extends ContentHandler { |
| 9 |
|
| 10 |
public function __construct( $dataModel, $formats = [ DummyContentForTesting::MODEL_ID ] ) { |
| 11 |
parent::__construct( $dataModel, $formats ); |
| 12 |
} |
| 13 |
|
| 14 |
protected function getContentClass() { |
| 15 |
return DummyContentForTesting::class; |
| 16 |
} |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
public function serializeContent( Content $content, $format = null ) { |
| 27 |
return $content->serialize(); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public function unserializeContent( $blob, $format = null ) { |
| 39 |
return new DummyContentForTesting( $blob ); |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public function makeEmptyContent() { |
| 47 |
return new DummyContentForTesting( '' ); |
| 48 |
} |
| 49 |
|
| 50 |
public function generateHTMLOnEdit(): bool { |
| 51 |
return false; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 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() ); |
| 69 |
} |
| 70 |
} |