parent::setUp();
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgContLang' => Language::factory( 'en' ),
'wgLanguageCode' => 'en',
'wgLegacyEncoding' => false,
'wgCompressRevisions' => false,
'wgContentHandlerTextFallback' => 'ignore',
- ) );
+ ] );
$this->mergeMwGlobalArrayValue(
'wgExtraNamespaces',
- array(
+ [
12312 => 'Dummy',
12313 => 'Dummy_talk',
- )
+ ]
);
$this->mergeMwGlobalArrayValue(
'wgNamespaceContentModels',
- array(
+ [
12312 => 'testing',
- )
+ ]
);
$this->mergeMwGlobalArrayValue(
'wgContentHandlers',
- array(
+ [
'testing' => 'DummyContentHandlerForTesting',
'RevisionTestModifyableContent' => 'RevisionTestModifyableContentHandler',
- )
+ ]
);
MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache
$content = ContentHandler::makeContent( $text, $title, $model, $format );
$rev = new Revision(
- array(
+ [
'id' => 42,
'page' => 23,
'title' => $title,
'minor_edit' => false,
'content_format' => $format,
- )
+ ]
);
return $rev;
function dataGetContentModel() {
// NOTE: we expect the help namespace to always contain wikitext
- return array(
- array( 'hello world', 'Help:Hello', null, null, CONTENT_MODEL_WIKITEXT ),
- array( 'hello world', 'User:hello/there.css', null, null, CONTENT_MODEL_CSS ),
- array( serialize( 'hello world' ), 'Dummy:Hello', null, null, "testing" ),
- );
+ return [
+ [ 'hello world', 'Help:Hello', null, null, CONTENT_MODEL_WIKITEXT ],
+ [ 'hello world', 'User:hello/there.css', null, null, CONTENT_MODEL_CSS ],
+ [ serialize( 'hello world' ), 'Dummy:Hello', null, null, "testing" ],
+ ];
}
/**
function dataGetContentFormat() {
// NOTE: we expect the help namespace to always contain wikitext
- return array(
- array( 'hello world', 'Help:Hello', null, null, CONTENT_FORMAT_WIKITEXT ),
- array( 'hello world', 'Help:Hello', CONTENT_MODEL_CSS, null, CONTENT_FORMAT_CSS ),
- array( 'hello world', 'User:hello/there.css', null, null, CONTENT_FORMAT_CSS ),
- array( serialize( 'hello world' ), 'Dummy:Hello', null, null, "testing" ),
- );
+ return [
+ [ 'hello world', 'Help:Hello', null, null, CONTENT_FORMAT_WIKITEXT ],
+ [ 'hello world', 'Help:Hello', CONTENT_MODEL_CSS, null, CONTENT_FORMAT_CSS ],
+ [ 'hello world', 'User:hello/there.css', null, null, CONTENT_FORMAT_CSS ],
+ [ serialize( 'hello world' ), 'Dummy:Hello', null, null, "testing" ],
+ ];
}
/**
function dataGetContentHandler() {
// NOTE: we expect the help namespace to always contain wikitext
- return array(
- array( 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ),
- array( 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ),
- array( serialize( 'hello world' ), 'Dummy:Hello', null, null, 'DummyContentHandlerForTesting' ),
- );
+ return [
+ [ 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ],
+ [ 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ],
+ [ serialize( 'hello world' ), 'Dummy:Hello', null, null, 'DummyContentHandlerForTesting' ],
+ ];
}
/**
function dataGetContent() {
// NOTE: we expect the help namespace to always contain wikitext
- return array(
- array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ),
- array(
+ return [
+ [ 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ],
+ [
serialize( 'hello world' ),
'Hello',
"testing",
null,
Revision::FOR_PUBLIC,
serialize( 'hello world' )
- ),
- array(
+ ],
+ [
serialize( 'hello world' ),
'Dummy:Hello',
null,
null,
Revision::FOR_PUBLIC,
serialize( 'hello world' )
- ),
- );
+ ],
+ ];
}
/**
);
}
- function dataGetText() {
- // NOTE: we expect the help namespace to always contain wikitext
- return array(
- array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ),
- array( serialize( 'hello world' ), 'Hello', "testing", null, Revision::FOR_PUBLIC, null ),
- array( serialize( 'hello world' ), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, null ),
- );
- }
-
- /**
- * @group Database
- * @dataProvider dataGetText
- * @covers Revision::getText
- */
- public function testGetText( $text, $title, $model, $format, $audience, $expectedText ) {
- $this->hideDeprecated( 'Revision::getText' );
-
- $rev = $this->newTestRevision( $text, $title, $model, $format );
-
- $this->assertEquals( $expectedText, $rev->getText( $audience ) );
- }
-
- /**
- * @group Database
- * @dataProvider dataGetText
- * @covers Revision::getRawText
- */
- public function testGetRawText( $text, $title, $model, $format, $audience, $expectedText ) {
- $this->hideDeprecated( 'Revision::getRawText' );
-
- $rev = $this->newTestRevision( $text, $title, $model, $format );
-
- $this->assertEquals( $expectedText, $rev->getRawText( $audience ) );
- }
-
public function dataGetSize() {
- return array(
- array( "hello world.", CONTENT_MODEL_WIKITEXT, 12 ),
- array( serialize( "hello world." ), "testing", 12 ),
- );
+ return [
+ [ "hello world.", CONTENT_MODEL_WIKITEXT, 12 ],
+ [ serialize( "hello world." ), "testing", 12 ],
+ ];
}
/**
}
public function dataGetSha1() {
- return array(
- array( "hello world.", CONTENT_MODEL_WIKITEXT, Revision::base36Sha1( "hello world." ) ),
- array(
+ return [
+ [ "hello world.", CONTENT_MODEL_WIKITEXT, Revision::base36Sha1( "hello world." ) ],
+ [
serialize( "hello world." ),
"testing",
Revision::base36Sha1( serialize( "hello world." ) )
- ),
- );
+ ],
+ ];
}
/**
* @covers Revision::__construct
*/
public function testConstructWithText() {
- $this->hideDeprecated( "Revision::getText" );
-
- $rev = new Revision( array(
+ $rev = new Revision( [
'text' => 'hello world.',
'content_model' => CONTENT_MODEL_JAVASCRIPT
- ) );
+ ] );
- $this->assertNotNull( $rev->getText(), 'no content text' );
$this->assertNotNull( $rev->getContent(), 'no content object available' );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
* @covers Revision::__construct
*/
public function testConstructWithContent() {
- $this->hideDeprecated( "Revision::getText" );
-
$title = Title::newFromText( 'RevisionTest_testConstructWithContent' );
- $rev = new Revision( array(
+ $rev = new Revision( [
'content' => ContentHandler::makeContent( 'hello world.', $title, CONTENT_MODEL_JAVASCRIPT ),
- ) );
+ ] );
- $this->assertNotNull( $rev->getText(), 'no content text' );
$this->assertNotNull( $rev->getContent(), 'no content object available' );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
$content = new RevisionTestModifyableContent( "foo" );
$rev = new Revision(
- array(
+ [
'id' => 42,
'page' => 23,
'title' => Title::newFromText( "testGetContentClone_dummy" ),
'length' => $content->getSize(),
'comment' => "testing",
'minor_edit' => false,
- )
+ ]
);
$content = $rev->getContent( Revision::RAW );
class RevisionTestModifyableContentHandler extends TextContentHandler {
public function __construct() {
- parent::__construct( "RevisionTestModifyableContent", array( CONTENT_FORMAT_TEXT ) );
+ parent::__construct( "RevisionTestModifyableContent", [ CONTENT_FORMAT_TEXT ] );
}
public function unserializeContent( $text, $format = null ) {