MediaWiki REL1_31
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
39 $content = $handler->makeEmptyContent();
40 $this->assertInstanceOf( Content::class, $content );
41 if ( $handler instanceof TextContentHandler ) {
42 // TextContentHandler::getContentClass() is protected, so bypass
43 // that restriction
44 $testingWrapper = TestingAccessWrapper::newFromObject( $handler );
45 $this->assertInstanceOf( $testingWrapper->getContentClass(), $content );
46 }
47
48 $handlerClass = get_class( $handler );
49 $contentClass = get_class( $content );
50
51 if ( $handler->supportsDirectEditing() ) {
52 $this->assertTrue(
53 $content->isValid(),
54 "$handlerClass::makeEmptyContent() did not return a valid content ($contentClass::isValid())"
55 );
56 }
57 }
58
59}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
testMakeEmptyContent(ContentHandler $handler)
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:903