class LinksUpdateTest extends MediaWikiLangTestCase {
protected $testingPageId;
- function __construct( $name = null, array $data = array(), $dataName = '' ) {
+ function __construct( $name = null, array $data = [], $dataName = '' ) {
parent::__construct( $name, $data, $dataName );
$this->tablesUsed = array_merge( $this->tablesUsed,
- array(
+ [
'interwiki',
'page_props',
'pagelinks',
'templatelinks',
'iwlinks',
'recentchanges',
- )
+ ]
);
}
$dbw = wfGetDB( DB_MASTER );
$dbw->replace(
'interwiki',
- array( 'iw_prefix' ),
- array(
+ [ 'iw_prefix' ],
+ [
'iw_prefix' => 'linksupdatetest',
'iw_url' => 'http://testing.com/wiki/$1',
'iw_api' => 'http://testing.com/w/api.php',
'iw_local' => 0,
'iw_trans' => 0,
'iw_wikiid' => 'linksupdatetest',
- )
+ ]
);
$this->setMwGlobals( 'wgRCWatchCategoryMembership', true );
}
$po = new ParserOutput();
$po->setTitleText( $t->getPrefixedText() );
- return array( $t, $po );
+ return [ $t, $po ];
}
/**
'pl_namespace,
pl_title',
'pl_from = ' . $this->testingPageId,
- array( array( NS_MAIN, 'Foo' ) )
+ [ [ NS_MAIN, 'Foo' ] ]
);
- $this->assertArrayEquals( array(
+ $this->assertArrayEquals( [
Title::makeTitle( NS_MAIN, 'Foo' ), // newFromText doesn't yield the same internal state....
- ), $update->getAddedLinks() );
+ ], $update->getAddedLinks() );
$po = new ParserOutput();
$po->setTitleText( $t->getPrefixedText() );
'pl_namespace,
pl_title',
'pl_from = ' . $this->testingPageId,
- array(
- array( NS_MAIN, 'Bar' ),
- array( NS_TALK, 'Bar' ),
- )
+ [
+ [ NS_MAIN, 'Bar' ],
+ [ NS_TALK, 'Bar' ],
+ ]
);
- $this->assertArrayEquals( array(
+ $this->assertArrayEquals( [
Title::makeTitle( NS_MAIN, 'Bar' ),
Title::makeTitle( NS_TALK, 'Bar' ),
- ), $update->getAddedLinks() );
- $this->assertArrayEquals( array(
+ ], $update->getAddedLinks() );
+ $this->assertArrayEquals( [
Title::makeTitle( NS_MAIN, 'Foo' ),
- ), $update->getRemovedLinks() );
+ ], $update->getRemovedLinks() );
}
/**
'externallinks',
'el_to, el_index',
'el_from = ' . $this->testingPageId,
- array(
- array( 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ),
- )
+ [
+ [ 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ],
+ ]
);
}
'categorylinks',
'cl_to, cl_sortkey',
'cl_from = ' . $this->testingPageId,
- array( array( 'Foo', "FOO\nTESTING" ) )
+ [ [ 'Foo', "FOO\nTESTING" ] ]
);
}
$title,
$wikiPage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Category:Foo' ),
- array( array( 'Foo', '[[:Testing]] added to category' ) )
+ [ [ 'Foo', '[[:Testing]] added to category' ] ]
);
$wikiPage->doEditContent( new WikitextContent( '[[Category:Bar]]' ), 'replaced category' );
$title,
$wikiPage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Category:Foo' ),
- array(
- array( 'Foo', '[[:Testing]] added to category' ),
- array( 'Foo', '[[:Testing]] removed from category' ),
- )
+ [
+ [ 'Foo', '[[:Testing]] added to category' ],
+ [ 'Foo', '[[:Testing]] removed from category' ],
+ ]
);
$this->assertRecentChangeByCategorization(
$title,
$wikiPage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Category:Bar' ),
- array(
- array( 'Bar', '[[:Testing]] added to category' ),
- )
+ [
+ [ 'Bar', '[[:Testing]] added to category' ],
+ ]
);
}
$templateTitle,
$templatePage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Baz' ),
- array()
+ []
);
$templatePage->doEditContent( new WikitextContent( '[[Category:Baz]]' ), 'added category' );
$templateTitle,
$templatePage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Baz' ),
- array( array( 'Baz', '[[:Template:TestingTemplate]] and 2 pages added to category' ) )
+ [ [ 'Baz', '[[:Template:TestingTemplate]] and 2 pages added to category' ] ]
);
}
'iwlinks',
'iwl_prefix, iwl_title',
'iwl_from = ' . $this->testingPageId,
- array( array( 'linksupdatetest', 'Foo' ) )
+ [ [ 'linksupdatetest', 'Foo' ] ]
);
}
'tl_namespace,
tl_title',
'tl_from = ' . $this->testingPageId,
- array( array( NS_TEMPLATE, 'Foo' ) )
+ [ [ NS_TEMPLATE, 'Foo' ] ]
);
}
'imagelinks',
'il_to',
'il_from = ' . $this->testingPageId,
- array( array( 'Foo.png' ) )
+ [ [ 'Foo.png' ] ]
);
}
* @covers ParserOutput::addLanguageLink
*/
public function testUpdate_langlinks() {
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgCapitalLinks' => true,
- ) );
+ ] );
/** @var ParserOutput $po */
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
'langlinks',
'll_lang, ll_title',
'll_from = ' . $this->testingPageId,
- array( array( 'En', 'Foo' ) )
+ [ [ 'En', 'Foo' ] ]
);
}
/** @var ParserOutput $po */
list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
- $fields = array( 'pp_propname', 'pp_value' );
- $expected = array();
+ $fields = [ 'pp_propname', 'pp_value' ];
+ $expected = [];
$po->setProperty( "bool", true );
- $expected[] = array( "bool", true );
+ $expected[] = [ "bool", true ];
$po->setProperty( "float", 4.0 + 1.0 / 4.0 );
- $expected[] = array( "float", 4.0 + 1.0 / 4.0 );
+ $expected[] = [ "float", 4.0 + 1.0 / 4.0 ];
$po->setProperty( "int", -7 );
- $expected[] = array( "int", -7 );
+ $expected[] = [ "int", -7 ];
$po->setProperty( "string", "33 bar" );
- $expected[] = array( "string", "33 bar" );
+ $expected[] = [ "string", "33 bar" ];
// compute expected sortkey values
if ( $wgPagePropsHaveSortkey ) {
$this->assertSelect(
'recentchanges',
'rc_title, rc_comment',
- array(
+ [
'rc_type' => RC_CATEGORIZE,
'rc_namespace' => NS_CATEGORY,
'rc_title' => $categoryTitle->getDBkey()
- ),
+ ],
$expectedRows
);
}