Merge "Add MediaWiki\Content namespace to FallbackContent{,Handler}"
This commit is contained in:
commit
a17833c271
13 changed files with 51 additions and 26 deletions
|
|
@ -254,6 +254,8 @@ because of Phabricator reports.
|
|||
- MediaWiki\Content:
|
||||
- CssContent
|
||||
- CssContentHandler
|
||||
- FallbackContent
|
||||
- FallbackContentHandler
|
||||
- JavaScriptContent
|
||||
- JavaScriptContentHandler
|
||||
- JsonContent
|
||||
|
|
|
|||
|
|
@ -987,6 +987,8 @@ $wgAutoloadLocalClasses = [
|
|||
'MediaWiki\\Content\\ContentHandlerFactory' => __DIR__ . '/includes/content/ContentHandlerFactory.php',
|
||||
'MediaWiki\\Content\\CssContent' => __DIR__ . '/includes/content/CssContent.php',
|
||||
'MediaWiki\\Content\\CssContentHandler' => __DIR__ . '/includes/content/CssContentHandler.php',
|
||||
'MediaWiki\\Content\\FallbackContent' => __DIR__ . '/includes/content/FallbackContent.php',
|
||||
'MediaWiki\\Content\\FallbackContentHandler' => __DIR__ . '/includes/content/FallbackContentHandler.php',
|
||||
'MediaWiki\\Content\\Hook\\ContentAlterParserOutputHook' => __DIR__ . '/includes/content/Hook/ContentAlterParserOutputHook.php',
|
||||
'MediaWiki\\Content\\Hook\\ContentGetParserOutputHook' => __DIR__ . '/includes/content/Hook/ContentGetParserOutputHook.php',
|
||||
'MediaWiki\\Content\\Hook\\ContentHandlerForModelIDHook' => __DIR__ . '/includes/content/Hook/ContentHandlerForModelIDHook.php',
|
||||
|
|
|
|||
|
|
@ -2034,7 +2034,7 @@ config-schema:
|
|||
json: MediaWiki\Content\JsonContentHandler
|
||||
css: MediaWiki\Content\CssContentHandler
|
||||
text: MediaWiki\Content\TextContentHandler
|
||||
unknown: FallbackContentHandler
|
||||
unknown: MediaWiki\Content\FallbackContentHandler
|
||||
type: object
|
||||
description: |-
|
||||
Plugins for page content model handling.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ use DoubleRedirectJob;
|
|||
use EmaillingJob;
|
||||
use EmptyBagOStuff;
|
||||
use EnotifNotifyJob;
|
||||
use FallbackContentHandler;
|
||||
use Generator;
|
||||
use HashBagOStuff;
|
||||
use HTMLCacheUpdateJob;
|
||||
|
|
@ -47,6 +46,7 @@ use MediaWiki\Auth\TemporaryPasswordAuthenticationRequest;
|
|||
use MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider;
|
||||
use MediaWiki\Auth\ThrottlePreAuthenticationProvider;
|
||||
use MediaWiki\Content\CssContentHandler;
|
||||
use MediaWiki\Content\FallbackContentHandler;
|
||||
use MediaWiki\Content\JavaScriptContentHandler;
|
||||
use MediaWiki\Content\JsonContentHandler;
|
||||
use MediaWiki\Content\TextContentHandler;
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ namespace MediaWiki\Revision;
|
|||
use BagOStuff;
|
||||
use Content;
|
||||
use DBAccessObjectUtils;
|
||||
use FallbackContent;
|
||||
use IDBAccessObject;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
use MediaWiki\CommentStore\CommentStore;
|
||||
use MediaWiki\CommentStore\CommentStoreComment;
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\IContentHandlerFactory;
|
||||
use MediaWiki\DAO\WikiAwareEntity;
|
||||
use MediaWiki\HookContainer\HookContainer;
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ return [
|
|||
'json' => 'MediaWiki\\Content\\JsonContentHandler',
|
||||
'css' => 'MediaWiki\\Content\\CssContentHandler',
|
||||
'text' => 'MediaWiki\\Content\\TextContentHandler',
|
||||
'unknown' => 'FallbackContentHandler',
|
||||
'unknown' => 'MediaWiki\\Content\\FallbackContentHandler',
|
||||
],
|
||||
'NamespaceContentModels' => [
|
||||
],
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@
|
|||
* @author Daniel Kinzler
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Content;
|
||||
|
||||
use AbstractContent;
|
||||
use Content;
|
||||
|
||||
/**
|
||||
* Content object implementation representing unknown content.
|
||||
*
|
||||
|
|
@ -147,3 +152,5 @@ class FallbackContent extends AbstractContent {
|
|||
}
|
||||
|
||||
}
|
||||
/** @deprecated class alias since 1.43 */
|
||||
class_alias( FallbackContent::class, 'FallbackContent' );
|
||||
|
|
|
|||
|
|
@ -23,10 +23,16 @@
|
|||
* @ingroup Content
|
||||
*/
|
||||
|
||||
namespace MediaWiki\Content;
|
||||
|
||||
use Content;
|
||||
use ContentHandler;
|
||||
use MediaWiki\Content\Renderer\ContentParseParams;
|
||||
use MediaWiki\Context\IContextSource;
|
||||
use MediaWiki\Html\Html;
|
||||
use MediaWiki\Parser\ParserOutput;
|
||||
use SlotDiffRenderer;
|
||||
use UnsupportedSlotDiffRenderer;
|
||||
|
||||
/**
|
||||
* Content handler implementation for unknown content.
|
||||
|
|
@ -137,3 +143,5 @@ class FallbackContentHandler extends ContentHandler {
|
|||
return new UnsupportedSlotDiffRenderer( $context );
|
||||
}
|
||||
}
|
||||
/** @deprecated class alias since 1.43 */
|
||||
class_alias( FallbackContentHandler::class, 'FallbackContentHandler' );
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ namespace MediaWiki\Tests\Revision;
|
|||
|
||||
use Content;
|
||||
use Exception;
|
||||
use FallbackContent;
|
||||
use HashBagOStuff;
|
||||
use IDBAccessObject;
|
||||
use InvalidArgumentException;
|
||||
use MediaWiki\CommentStore\CommentStoreComment;
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\TextContent;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MainConfigNames;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\FallbackContentHandler;
|
||||
use MediaWiki\Context\RequestContext;
|
||||
use MediaWiki\Parser\ParserObserver;
|
||||
use MediaWiki\Request\FauxRequest;
|
||||
|
|
@ -52,7 +54,7 @@ class FallbackContentHandlerTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContentHandler::fillParserOutput
|
||||
* @covers \MediaWiki\Content\FallbackContentHandler::fillParserOutput
|
||||
*/
|
||||
public function testGetParserOutput() {
|
||||
$this->setUserLang( 'en' );
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\FallbackContentHandler;
|
||||
use MediaWiki\Content\JavaScriptContent;
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +30,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getRedirectTarget
|
||||
* @covers \MediaWiki\Content\FallbackContent::getRedirectTarget
|
||||
*/
|
||||
public function testGetRedirectTarget() {
|
||||
$content = $this->newContent( '#REDIRECT [[Horkyporky]]' );
|
||||
|
|
@ -36,7 +38,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::isRedirect
|
||||
* @covers \MediaWiki\Content\FallbackContent::isRedirect
|
||||
*/
|
||||
public function testIsRedirect() {
|
||||
$content = $this->newContent( '#REDIRECT [[Horkyporky]]' );
|
||||
|
|
@ -44,7 +46,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::isCountable
|
||||
* @covers \MediaWiki\Content\FallbackContent::isCountable
|
||||
*/
|
||||
public function testIsCountable() {
|
||||
$content = $this->newContent( '[[Horkyporky]]' );
|
||||
|
|
@ -52,7 +54,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getTextForSummary
|
||||
* @covers \MediaWiki\Content\FallbackContent::getTextForSummary
|
||||
*/
|
||||
public function testGetTextForSummary() {
|
||||
$content = $this->newContent( 'Horkyporky' );
|
||||
|
|
@ -60,7 +62,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getTextForSearchIndex
|
||||
* @covers \MediaWiki\Content\FallbackContent::getTextForSearchIndex
|
||||
*/
|
||||
public function testGetTextForSearchIndex() {
|
||||
$content = $this->newContent( 'Horkyporky' );
|
||||
|
|
@ -68,7 +70,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::copy
|
||||
* @covers \MediaWiki\Content\FallbackContent::copy
|
||||
*/
|
||||
public function testCopy() {
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
|
|
@ -78,7 +80,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getSize
|
||||
* @covers \MediaWiki\Content\FallbackContent::getSize
|
||||
*/
|
||||
public function testGetSize() {
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
|
|
@ -87,7 +89,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getData
|
||||
* @covers \MediaWiki\Content\FallbackContent::getData
|
||||
*/
|
||||
public function testGetData() {
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
|
|
@ -96,7 +98,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getNativeData
|
||||
* @covers \MediaWiki\Content\FallbackContent::getNativeData
|
||||
*/
|
||||
public function testGetNativeData() {
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
|
|
@ -105,7 +107,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getWikitextForTransclusion
|
||||
* @covers \MediaWiki\Content\FallbackContent::getWikitextForTransclusion
|
||||
*/
|
||||
public function testGetWikitextForTransclusion() {
|
||||
$content = $this->newContent( 'hello world.' );
|
||||
|
|
@ -114,7 +116,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getModel
|
||||
* @covers \MediaWiki\Content\FallbackContent::getModel
|
||||
*/
|
||||
public function testGetModel() {
|
||||
$content = $this->newContent( "hello world.", 'horkyporky' );
|
||||
|
|
@ -123,7 +125,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::getContentHandler
|
||||
* @covers \MediaWiki\Content\FallbackContent::getContentHandler
|
||||
*/
|
||||
public function testGetContentHandler() {
|
||||
$this->mergeMwGlobalArrayValue(
|
||||
|
|
@ -148,7 +150,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
|
||||
/**
|
||||
* @dataProvider dataIsEmpty
|
||||
* @covers \FallbackContent::isEmpty
|
||||
* @covers \MediaWiki\Content\FallbackContent::isEmpty
|
||||
*/
|
||||
public function testIsEmpty( $text, $empty ) {
|
||||
$content = $this->newContent( $text );
|
||||
|
|
@ -168,7 +170,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
|
||||
/**
|
||||
* @dataProvider provideEquals
|
||||
* @covers \FallbackContent::equals
|
||||
* @covers \MediaWiki\Content\FallbackContent::equals
|
||||
*/
|
||||
public function testEquals( Content $a, Content $b = null, $equal = false ) {
|
||||
$this->assertEquals( $equal, $a->equals( $b ) );
|
||||
|
|
@ -204,7 +206,7 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::convert
|
||||
* @covers \MediaWiki\Content\FallbackContent::convert
|
||||
*/
|
||||
public function testConvert() {
|
||||
$content = $this->newContent( 'More horkyporky?' );
|
||||
|
|
@ -213,8 +215,8 @@ class FallbackContentTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \FallbackContent::__construct
|
||||
* @covers \FallbackContentHandler::serializeContent
|
||||
* @covers \MediaWiki\Content\FallbackContent::__construct
|
||||
* @covers \MediaWiki\Content\FallbackContentHandler::serializeContent
|
||||
*/
|
||||
public function testSerialize() {
|
||||
$content = $this->newContent( 'Hörkypörky', 'horkyporky' );
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace MediaWiki\Tests\Unit;
|
||||
|
||||
use FallbackContent;
|
||||
use FallbackContentHandler;
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\FallbackContentHandler;
|
||||
use MediaWiki\Revision\SlotRecord;
|
||||
use MediaWiki\Revision\SlotRenderingProvider;
|
||||
use MediaWiki\Title\Title;
|
||||
|
|
@ -13,7 +13,7 @@ use MediaWikiUnitTestCase;
|
|||
* Split from \FallbackContentHandlerTest integration tests
|
||||
*
|
||||
* @group ContentHandler
|
||||
* @coversDefaultClass \FallbackContentHandler
|
||||
* @coversDefaultClass \MediaWiki\Content\FallbackContentHandler
|
||||
*/
|
||||
class FallbackContentHandlerTest extends MediaWikiUnitTestCase {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Content\FallbackContent;
|
||||
use MediaWiki\Content\FallbackContentHandler;
|
||||
use MediaWiki\Content\TextContent;
|
||||
use MediaWiki\Content\TextContentHandler;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue