* ^--- make sure temporary tables are used.
*/
class LinksUpdateTest extends MediaWikiLangTestCase {
- protected $testingPageId;
+ protected static $testingPageId;
function __construct( $name = null, array $data = [], $dataName = '' ) {
parent::__construct( $name, $data, $dataName );
$this->setMwGlobals( 'wgRCWatchCategoryMembership', true );
}
- public function addDBData() {
+ public function addDBDataOnce() {
$res = $this->insertPage( 'Testing' );
- $this->testingPageId = $res['id'];
+ self::$testingPageId = $res['id'];
$this->insertPage( 'Some_other_page' );
$this->insertPage( 'Template:TestingTemplate' );
}
public function testUpdate_pagelinks() {
/** @var Title $t */
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addLink( Title::newFromText( "Foo" ) );
$po->addLink( Title::newFromText( "Special:Foo" ) ); // special namespace should be ignored
'pagelinks',
'pl_namespace,
pl_title',
- 'pl_from = ' . $this->testingPageId,
+ 'pl_from = ' . self::$testingPageId,
[ [ NS_MAIN, 'Foo' ] ]
);
$this->assertArrayEquals( [
'pagelinks',
'pl_namespace,
pl_title',
- 'pl_from = ' . $this->testingPageId,
+ 'pl_from = ' . self::$testingPageId,
[
[ NS_MAIN, 'Bar' ],
[ NS_TALK, 'Bar' ],
*/
public function testUpdate_externallinks() {
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addExternalLink( "http://testing.com/wiki/Foo" );
$po,
'externallinks',
'el_to, el_index',
- 'el_from = ' . $this->testingPageId,
+ 'el_from = ' . self::$testingPageId,
[
[ 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ],
]
/** @var ParserOutput $po */
$this->setMwGlobals( 'wgCategoryCollation', 'uppercase' );
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addCategory( "Foo", "FOO" );
$po,
'categorylinks',
'cl_to, cl_sortkey',
- 'cl_from = ' . $this->testingPageId,
+ 'cl_from = ' . self::$testingPageId,
[ [ 'Foo', "FOO\nTESTING" ] ]
);
}
$templateTitle,
$templatePage->getParserOutput( new ParserOptions() ),
Title::newFromText( 'Baz' ),
- [ [ 'Baz', '[[:Template:TestingTemplate]] and 2 pages added to category' ] ]
+ [ [
+ 'Baz',
+ '[[:Template:TestingTemplate]] added to category, ' .
+ '[[Special:WhatLinksHere/Template:TestingTemplate|this page is included within other pages]]'
+ ] ]
);
}
*/
public function testUpdate_iwlinks() {
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$target = Title::makeTitleSafe( NS_MAIN, "Foo", '', 'linksupdatetest' );
$po->addInterwikiLink( $target );
$po,
'iwlinks',
'iwl_prefix, iwl_title',
- 'iwl_from = ' . $this->testingPageId,
+ 'iwl_from = ' . self::$testingPageId,
[ [ 'linksupdatetest', 'Foo' ] ]
);
}
*/
public function testUpdate_templatelinks() {
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addTemplate( Title::newFromText( "Template:Foo" ), 23, 42 );
'templatelinks',
'tl_namespace,
tl_title',
- 'tl_from = ' . $this->testingPageId,
+ 'tl_from = ' . self::$testingPageId,
[ [ NS_TEMPLATE, 'Foo' ] ]
);
}
*/
public function testUpdate_imagelinks() {
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addImage( "Foo.png" );
$po,
'imagelinks',
'il_to',
- 'il_from = ' . $this->testingPageId,
+ 'il_from = ' . self::$testingPageId,
[ [ 'Foo.png' ] ]
);
}
] );
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$po->addLanguageLink( Title::newFromText( "en:Foo" )->getFullText() );
$po,
'langlinks',
'll_lang, ll_title',
- 'll_from = ' . $this->testingPageId,
+ 'll_from = ' . self::$testingPageId,
[ [ 'En', 'Foo' ] ]
);
}
global $wgPagePropsHaveSortkey;
/** @var ParserOutput $po */
- list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", $this->testingPageId );
+ list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", self::$testingPageId );
$fields = [ 'pp_propname', 'pp_value' ];
$expected = [];
}
$this->assertLinksUpdate(
- $t, $po, 'page_props', $fields, 'pp_page = ' . $this->testingPageId, $expected );
+ $t, $po, 'page_props', $fields, 'pp_page = ' . self::$testingPageId, $expected );
}
public function testUpdate_page_props_without_sortkey() {