Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/297341

Change subject: Don't re-declare MediaWikiTestCase::insertPage in 
SearchHookHandlerTest
......................................................................

Don't re-declare MediaWikiTestCase::insertPage in SearchHookHandlerTest

Also some style things and make sure there are no page id
conflicts.

Change-Id: If903bc8bc412719b97b5b5dcc4d194ef275538bd
---
M tests/phpunit/includes/SearchHookHandlerTest.php
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticlePlaceholder 
refs/changes/41/297341/1

diff --git a/tests/phpunit/includes/SearchHookHandlerTest.php 
b/tests/phpunit/includes/SearchHookHandlerTest.php
index 171c695..e9103c1 100644
--- a/tests/phpunit/includes/SearchHookHandlerTest.php
+++ b/tests/phpunit/includes/SearchHookHandlerTest.php
@@ -130,15 +130,15 @@
         * Insert necessary data in the page_props and page table
         * @param DatabaseBase $db
         * @param int $pageId
-        * @param string $entityId
+        * @param string $entityIdSer
         * @param int $numSitelinks
         * @param int $numClaims
+        * @param int $itemNamespace
         */
        private function insertPageProps(
                DatabaseBase $db, $pageId, $entityIdSer, $numSitelinks, 
$numClaims, $itemNamespace
        ) {
                $this->tablesUsed[] = 'page_props';
-               $this->tablesUsed[] = 'page';
                $db->insert(
                        'page_props',
                        [
@@ -154,11 +154,10 @@
                                ]
                        ]
                );
-               $this->insertPage( $db, $pageId, $entityIdSer, $itemNamespace );
+               $this->insertPageRecord( $db, $pageId, $entityIdSer, 
$itemNamespace );
        }
 
-       protected function insertPage( DatabaseBase $db, $pageId, $entityIdSer, 
$itemNamespace ) {
-               $this->tablesUsed[] = 'page';
+       protected function insertPageRecord( DatabaseBase $db, $pageId, 
$entityIdSer, $itemNamespace ) {
                $db->insert(
                        'page',
                        [
@@ -212,6 +211,8 @@
                $connectionManager = new ConsistentReadConnectionManager( 
wfGetLB( $repoDb ), $repoDb );
 
                $db = $connectionManager->getWriteConnection();
+               $db->delete( 'page', '*', __METHOD__ );
+               $db->delete( 'page_props', '*', __METHOD__ );
 
                $this->insertPageProps(
                        $db, $pageId, $entityIdSer, $numSitelinks, $numClaims, 
$itemNamespace
@@ -219,7 +220,7 @@
                // test an item with only 2 sitelinks and 2 claims
                $this->insertPageProps( $db, 111, 'Q111', 2, 2, $itemNamespace 
);
                // test an item only in page table, not in pageprops
-               $this->insertPage( $db, 222, 'Q222', $itemNamespace );
+               $this->insertPageRecord( $db, 222, 'Q222', $itemNamespace );
 
                $specialSearch = $this->getSpecialSearch();
                $output = new OutputPage( new RequestContext() );

-- 
To view, visit https://gerrit.wikimedia.org/r/297341
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If903bc8bc412719b97b5b5dcc4d194ef275538bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ArticlePlaceholder
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to