wiki.techinc.nl/tests/phpunit/mocks/content/DummyContentHandlerForTesting.php
addshore 9fe46fdd32 Split Revision tests into Unit & Integration classes
Change-Id: If10b102a1a0d680b5f067bf34c0fafcb59c09048
2017-10-13 14:46:36 +01:00

42 lines
927 B
PHP

<?php
class DummyContentHandlerForTesting extends ContentHandler {
public function __construct( $dataModel ) {
parent::__construct( $dataModel, [ DummyContentForTesting::MODEL_ID ] );
}
/**
* @see ContentHandler::serializeContent
*
* @param Content $content
* @param string $format
*
* @return string
*/
public function serializeContent( Content $content, $format = null ) {
return $content->serialize();
}
/**
* @see ContentHandler::unserializeContent
*
* @param string $blob
* @param string $format Unused.
*
* @return Content
*/
public function unserializeContent( $blob, $format = null ) {
$d = unserialize( $blob );
return new DummyContentForTesting( $d );
}
/**
* Creates an empty Content object of the type supported by this ContentHandler.
* @return DummyContentForTesting
*/
public function makeEmptyContent() {
return new DummyContentForTesting( '' );
}
}