2015-04-15 08:26:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
2021-08-24 12:17:12 +00:00
|
|
|
use MediaWiki\Content\Renderer\ContentParseParams;
|
|
|
|
|
|
2015-04-15 08:26:22 +00:00
|
|
|
class DummyContentHandlerForTesting extends ContentHandler {
|
|
|
|
|
|
2018-03-20 13:25:26 +00:00
|
|
|
public function __construct( $dataModel, $formats = [ DummyContentForTesting::MODEL_ID ] ) {
|
|
|
|
|
parent::__construct( $dataModel, $formats );
|
2015-04-15 08:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
2021-07-21 01:03:59 +00:00
|
|
|
protected function getContentClass() {
|
|
|
|
|
return DummyContentForTesting::class;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-15 08:26:22 +00:00
|
|
|
/**
|
|
|
|
|
* @see ContentHandler::serializeContent
|
|
|
|
|
*
|
|
|
|
|
* @param Content $content
|
2018-06-26 21:14:43 +00:00
|
|
|
* @param string|null $format
|
2015-04-15 08:26:22 +00:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function serializeContent( Content $content, $format = null ) {
|
|
|
|
|
return $content->serialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @see ContentHandler::unserializeContent
|
|
|
|
|
*
|
|
|
|
|
* @param string $blob
|
2018-06-26 21:14:43 +00:00
|
|
|
* @param string|null $format Unused.
|
2015-04-15 08:26:22 +00:00
|
|
|
*
|
|
|
|
|
* @return Content
|
|
|
|
|
*/
|
|
|
|
|
public function unserializeContent( $blob, $format = null ) {
|
2021-10-20 02:08:02 +00:00
|
|
|
return new DummyContentForTesting( $blob );
|
2015-04-15 08:26:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an empty Content object of the type supported by this ContentHandler.
|
2017-09-09 20:47:04 +00:00
|
|
|
* @return DummyContentForTesting
|
2015-04-15 08:26:22 +00:00
|
|
|
*/
|
|
|
|
|
public function makeEmptyContent() {
|
|
|
|
|
return new DummyContentForTesting( '' );
|
|
|
|
|
}
|
2021-08-16 14:34:58 +00:00
|
|
|
|
|
|
|
|
public function generateHTMLOnEdit(): bool {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-08-24 12:17:12 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @see ContentHandler::fillParserOutput()
|
|
|
|
|
*
|
|
|
|
|
* @since 1.38
|
|
|
|
|
* @param Content $content
|
|
|
|
|
* @param ContentParseParams $cpoParams
|
|
|
|
|
* @param ParserOutput &$output The output object to fill (reference).
|
|
|
|
|
*/
|
|
|
|
|
protected function fillParserOutput(
|
|
|
|
|
Content $content,
|
|
|
|
|
ContentParseParams $cpoParams,
|
|
|
|
|
ParserOutput &$output
|
|
|
|
|
) {
|
|
|
|
|
'@phan-var DummyContentForTesting $content';
|
|
|
|
|
$output = new ParserOutput( $content->getNativeData() );
|
|
|
|
|
}
|
2015-04-15 08:26:22 +00:00
|
|
|
}
|