<?php
/**
+ * @covers LinksUpdate
* @group LinksUpdate
* @group Database
* ^--- make sure temporary tables are used.
/**
* @covers ParserOutput::addExternalLink
+ * @covers LinksUpdate::getAddedExternalLinks
+ * @covers LinksUpdate::getRemovedExternalLinks
*/
public function testUpdate_externallinks() {
/** @var ParserOutput $po */
$po->addExternalLink( "http://testing.com/wiki/Foo" );
- $this->assertLinksUpdate(
+ $update = $this->assertLinksUpdate(
$t,
$po,
'externallinks',
[ 'http://testing.com/wiki/Foo', 'http://com.testing./wiki/Foo' ],
]
);
+
+ $this->assertArrayEquals( [
+ "http://testing.com/wiki/Foo"
+ ], $update->getAddedExternalLinks() );
+
+ $po = new ParserOutput();
+ $po->setTitleText( $t->getPrefixedText() );
+ $po->addExternalLink( 'http://testing.com/wiki/Bar' );
+ $update = $this->assertLinksUpdate(
+ $t,
+ $po,
+ 'externallinks',
+ 'el_to, el_index',
+ 'el_from = ' . self::$testingPageId,
+ [
+ [ 'http://testing.com/wiki/Bar', 'http://com.testing./wiki/Bar' ],
+ ]
+ );
+
+ $this->assertArrayEquals( [
+ "http://testing.com/wiki/Bar"
+ ], $update->getAddedExternalLinks() );
+ $this->assertArrayEquals( [
+ "http://testing.com/wiki/Foo"
+ ], $update->getRemovedExternalLinks() );
}
/**
Title $pageTitle, ParserOutput $parserOutput, Title $categoryTitle, $expectedRows
) {
$this->assertSelect(
- 'recentchanges',
- 'rc_title, rc_comment',
+ [ 'recentchanges', 'comment' ],
+ 'rc_title, comment_text',
[
'rc_type' => RC_CATEGORIZE,
'rc_namespace' => NS_CATEGORY,
- 'rc_title' => $categoryTitle->getDBkey()
+ 'rc_title' => $categoryTitle->getDBkey(),
+ 'comment_id = rc_comment_id',
],
$expectedRows
);