From 5faf4a5968dd851f14b1f8b4dde2b99b78ae47f6 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sat, 26 Aug 2017 21:06:29 +0200 Subject: [PATCH] Test Targets class. --- tests/phpunit/ParseOnEditTest.php | 4 ++-- tests/phpunit/TargetsTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/ParseOnEditTest.php b/tests/phpunit/ParseOnEditTest.php index 2441b21..817ddfa 100644 --- a/tests/phpunit/ParseOnEditTest.php +++ b/tests/phpunit/ParseOnEditTest.php @@ -10,9 +10,9 @@ class ParseOnEditTest extends LinkTitles\TestCase { 'wgLinkTitlesParseOnEdit' => true, 'wgLinkTitlesParseOnRender' => false ] ); - $pageId = $this->insertPage( 'test page', 'This page should link to the link target' )['id']; + $pageId = $this->insertPage( 'test page', 'This page should link to the link target but not to test page' )['id']; $page = WikiPage::newFromId( $pageId ); - $this->assertSame( 'This page should link to the [[link target]]', self::getPageText( $page ) ); + $this->assertSame( 'This page should link to the [[link target]] but not to test page', self::getPageText( $page ) ); } public function testDoNotParseOnEdit() { diff --git a/tests/phpunit/TargetsTest.php b/tests/phpunit/TargetsTest.php index c0debaf..820af17 100644 --- a/tests/phpunit/TargetsTest.php +++ b/tests/phpunit/TargetsTest.php @@ -17,10 +17,10 @@ class TargetsTest extends LinkTitles\TestCase { // Count number of articles: Inspired by updateArticleCount.php maintenance // script: https://doc.wikimedia.org/mediawiki-core/master/php/updateArticleCount_8php_source.html - $dbr = $this->getDB( DB_MASTER ); + $dbr = wfGetDB( DB_SLAVE ); $counter = new SiteStatsInit( $dbr ); - $count = $counter->articles(); + $count = $counter->pages(); - $this->assertSame( $targets->queryResult->numRows(), $count ); + $this->assertEquals( $targets->queryResult->numRows(), $count ); } }