Go to the documentation of this file.
7 protected function setUp() {
14 'wgLanguageCode' =>
'en',
15 'wgLegacyEncoding' =>
false,
16 'wgCompressRevisions' =>
false,
18 'wgContentHandlerTextFallback' =>
'ignore',
25 12313 =>
'Dummy_talk',
30 'wgNamespaceContentModels',
39 'testing' =>
'DummyContentHandlerForTesting',
40 'RevisionTestModifyableContent' =>
'RevisionTestModifyableContentHandler',
63 $row->old_text =
'This is a bunch of revision text.';
65 'This is a bunch of revision text.',
76 $row->old_flags =
'gzip';
77 $row->old_text = gzdeflate(
'This is a bunch of revision text.' );
79 'This is a bunch of revision text.',
88 $row->old_flags =
'utf-8';
89 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
90 $GLOBALS[
'wgLegacyEncoding'] =
'iso-8859-1';
92 "Wiki est l'\xc3\xa9cole superieur !",
101 $row->old_flags =
'';
102 $row->old_text =
"Wiki est l'\xe9cole superieur !";
103 $GLOBALS[
'wgLegacyEncoding'] =
'iso-8859-1';
105 "Wiki est l'\xc3\xa9cole superieur !",
116 $row->old_flags =
'gzip,utf-8';
117 $row->old_text = gzdeflate(
"Wiki est l'\xc3\xa9cole superieur !" );
118 $GLOBALS[
'wgLegacyEncoding'] =
'iso-8859-1';
120 "Wiki est l'\xc3\xa9cole superieur !",
131 $row->old_flags =
'gzip';
132 $row->old_text = gzdeflate(
"Wiki est l'\xe9cole superieur !" );
133 $GLOBALS[
'wgLegacyEncoding'] =
'iso-8859-1';
135 "Wiki est l'\xc3\xa9cole superieur !",
144 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
146 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
147 "Flags should contain 'utf-8'" );
148 $this->assertFalse(
false !== strpos( $row->old_flags,
'gzip' ),
149 "Flags should not contain 'gzip'" );
150 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
151 $row->old_text,
"Direct check" );
152 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
164 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
166 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
167 "Flags should contain 'utf-8'" );
168 $this->assertTrue(
false !== strpos( $row->old_flags,
'gzip' ),
169 "Flags should contain 'gzip'" );
170 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
171 gzinflate( $row->old_text ),
"Direct check" );
172 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
176 # =================================================================================================================
187 if ( is_string(
$title ) ) {
199 'content' => $content,
200 'length' => $content->getSize(),
201 'comment' =>
"testing",
202 'minor_edit' =>
false,
204 'content_format' => $format,
216 array( serialize(
'hello world' ),
'Dummy:Hello',
null,
null,
"testing" ),
228 $this->assertEquals( $expectedModel,
$rev->getContentModel() );
237 array( serialize(
'hello world' ),
'Dummy:Hello',
null,
null,
"testing" ),
249 $this->assertEquals( $expectedFormat,
$rev->getContentFormat() );
255 array(
'hello world',
'Help:Hello',
null,
null,
'WikitextContentHandler' ),
256 array(
'hello world',
'User:hello/there.css',
null,
null,
'CssContentHandler' ),
257 array( serialize(
'hello world' ),
'Dummy:Hello',
null,
null,
'DummyContentHandlerForTesting' ),
269 $this->assertEquals( $expectedClass, get_class(
$rev->getContentHandler() ) );
288 $content =
$rev->getContent( $audience );
290 $this->assertEquals( $expectedSerialization, is_null( $content ) ?
null : $content->serialize( $format ) );
312 $this->assertEquals( $expectedText,
$rev->getText( $audience ) );
325 $this->assertEquals( $expectedText,
$rev->getRawText( $audience ) );
331 array( serialize(
"hello world." ),
"testing", 12 ),
342 $this->assertEquals( $expected_size,
$rev->getSize() );
359 $this->assertEquals( $expected_hash,
$rev->getSha1() );
369 'text' =>
'hello world.',
373 $this->assertNotNull(
$rev->getText(),
'no content text' );
374 $this->assertNotNull(
$rev->getContent(),
'no content object available' );
391 $this->assertNotNull(
$rev->getText(),
'no content text' );
392 $this->assertNotNull(
$rev->getContent(),
'no content object available' );
412 'content' => $content,
413 'length' => $content->getSize(),
414 'comment' =>
"testing",
415 'minor_edit' =>
false,
420 $content->setText(
"bar" );
423 $this->assertNotSame( $content, $content2,
"expected a clone" );
424 $this->assertEquals(
"foo", $content2->getText() );
426 $content2->setText(
"bla bla" );
427 $this->assertEquals(
"bar", $content->getText() );
442 $this->assertSame( $content, $content2 );
448 parent::__construct( $text,
"RevisionTestModifyableContent" );
460 $this->mText = $text;
471 $this->checkFormat( $format );
testGetText( $text, $title, $model, $format, $audience, $expectedText)
@group Database @dataProvider dataGetText @covers Revision::getText
testConstructWithContent()
@covers Revision::__construct
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
testGetSize( $text, $model, $expected_size)
@covers Revision::getSize @group Database @dataProvider dataGetSize
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
testGetRevisionTextUtf8Native()
@covers Revision::getRevisionText
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
const CONTENT_MODEL_WIKITEXT
testGetRevisionTextUtf8NativeGzip()
@covers Revision::getRevisionText
you have access to all of the normal MediaWiki so you can get a DB use the cache
static base36Sha1( $text)
Get the base 36 SHA-1 value for a string of text.
testGetRevisionTextUtf8LegacyGzip()
@covers Revision::getRevisionText
testGetRevisionText()
@covers Revision::getRevisionText
testConstructWithText()
@covers Revision::__construct
testCompressRevisionTextUtf8Gzip()
@covers Revision::compressRevisionText
static compressRevisionText(&$text)
If $wgCompressRevisions is enabled, we will compress data.
const CONTENT_FORMAT_TEXT
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
testGetRawText( $text, $title, $model, $format, $audience, $expectedText)
@group Database @dataProvider dataGetText @covers Revision::getRawText
const CONTENT_FORMAT_WIKITEXT
newTestRevision( $text, $title="Test", $model=CONTENT_MODEL_WIKITEXT, $format=null)
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
presenting them properly to the user as errors is done by the caller $title
when a variable name is used in a function
Base content handler implementation for flat text contents.
testGetContentModel( $text, $title, $model, $format, $expectedModel)
@group Database @dataProvider dataGetContentModel @covers Revision::getContentModel
Content object implementation for representing flat text.
testGetRevisionTextGzip()
@covers Revision::getRevisionText
testGetContentHandler( $text, $title, $model, $format, $expectedClass)
@group Database @dataProvider dataGetContentHandler @covers Revision::getContentHandler
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
makeEmptyContent()
Creates an empty TextContent object.
testGetRevisionTextUtf8Legacy()
@covers Revision::getRevisionText
testGetContentFormat( $text, $title, $model, $format, $expectedFormat)
@group Database @dataProvider dataGetContentFormat @covers Revision::getContentFormat
testGetContentUncloned()
Tests whether $rev->getContent() returns the same object repeatedly if appropriate.
static getCanonicalNamespaces( $rebuild=false)
Returns array of all defined namespaces with their canonical (English) names.
static factory( $code)
Get a cached or new language object for a given language code.
const CONTENT_MODEL_JAVASCRIPT
testGetContent( $text, $title, $model, $format, $audience, $expectedSerialization)
@group Database @dataProvider dataGetContent @covers Revision::getContent
testGetContentClone()
Tests whether $rev->getContent() returns a clone when needed.
unserializeContent( $text, $format=null)
Unserializes a Content object of the type supported by this ContentHandler.
testCompressRevisionTextUtf8()
@covers Revision::compressRevisionText
testGetSha1( $text, $model, $expected_hash)
@covers Revision::getSha1 @group Database @dataProvider dataGetSha1