MediaWiki REL1_32
ContentHandlerSanityTest.php
Go to the documentation of this file.
1<?php
2
3use Wikimedia\TestingAccessWrapper;
4
23
24 public static function provideHandlers() {
25 $models = ContentHandler::getContentModels();
26 $handlers = [];
27 foreach ( $models as $model ) {
28 $handlers[] = [ ContentHandler::getForModelID( $model ) ];
29 }
30
31 return $handlers;
32 }
33
40 $content = $handler->makeEmptyContent();
41 $this->assertInstanceOf( Content::class, $content );
42 if ( $handler instanceof TextContentHandler ) {
43 // TextContentHandler::getContentClass() is protected, so bypass
44 // that restriction
45 $testingWrapper = TestingAccessWrapper::newFromObject( $handler );
46 $this->assertInstanceOf( $testingWrapper->getContentClass(), $content );
47 }
48
49 $handlerClass = get_class( $handler );
50 $contentClass = get_class( $content );
51
52 if ( $handler->supportsDirectEditing() ) {
53 $this->assertTrue(
54 $content->isValid(),
55 "$handlerClass::makeEmptyContent() did not return a valid content ($contentClass::isValid())"
56 );
57 }
58 }
59
60}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
testMakeEmptyContent(ContentHandler $handler)
@coversNothing provideHandlers
A content handler knows how do deal with a specific type of content on a wiki page.
Base content handler implementation for flat text contents.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
Definition hooks.txt:933
$content