Nik has submitted this change and it was merged.

Change subject: Inserted prefix for special page name. Fix count in 
testOnNewRevisionFromEditComplete.
......................................................................


Inserted prefix for special page name.
Fix count in testOnNewRevisionFromEditComplete.

Change-Id: I9a5df39acda1f3a5770bb317a4791ddf609bd02d
---
M PubSubHubbub.body.php
M PubSubHubbub.php
M i18n/en.json
R specials/SpecialPubSubHubbubExport.php
M tests/phpunit/PubSubHubbubTest.php
5 files changed, 19 insertions(+), 16 deletions(-)

Approvals:
  Nik: Looks good to me, approved
  WikidataJenkins: Verified



diff --git a/PubSubHubbub.body.php b/PubSubHubbub.body.php
index 3c55b29..85361e3 100644
--- a/PubSubHubbub.body.php
+++ b/PubSubHubbub.body.php
@@ -103,7 +103,7 @@
         * @return string the generated resource URL.
         */
        public static function getPageURL( Title $title = null ) {
-               $specialTitle = Title::makeTitle( -1, 'PuSHExport' );
+               $specialTitle = Title::makeTitle( -1, 'PubSubHubbub-Export' );
 
                if ( is_null( $title ) ) {
                        return $specialTitle->getCanonicalURL();
diff --git a/PubSubHubbub.php b/PubSubHubbub.php
index 617f504..09e5638 100644
--- a/PubSubHubbub.php
+++ b/PubSubHubbub.php
@@ -49,12 +49,12 @@
 $wgExtensionMessagesFiles['PubSubHubbub'] = $dir . 'PubSubHubbub.i18n.php';
 
 $wgAutoloadClasses['PubSubHubbub\\PubSubHubbub'] = $dir . 
'PubSubHubbub.body.php';
-$wgAutoloadClasses['PubSubHubbub\\SpecialPuSHExport'] = $dir . 
'specials/SpecialPuSHExport.php';
+$wgAutoloadClasses['PubSubHubbub\\SpecialPubSubHubbubExport'] = $dir . 
'specials/SpecialPubSubHubbubExport.php';
 $wgAutoloadClasses['PubSubHubbub\\PublishChangesJob'] = $dir . 
'PublishChangesJob.php';
 $wgAutoloadClasses['PubSubHubbub\\Publisher'] = $dir . 'lib/Publisher.php';
 
-$wgSpecialPages['PuSHExport'] = 'PubSubHubbub\\SpecialPuSHExport';
-$wgSpecialPageGroups['PuSHExport'] = 'pagetools';
+$wgSpecialPages['PubSubHubbub-Export'] = 
'PubSubHubbub\\SpecialPubSubHubbubExport';
+$wgSpecialPageGroups['PubSubHubbub-Export'] = 'pagetools';
 
 $wgHooks['NewRevisionFromEditComplete'][] = 
'PubSubHubbub\\PubSubHubbub::onNewRevisionFromEditComplete';
 $wgHooks['OutputPageBeforeHTML'][] = 
'PubSubHubbub\\PubSubHubbub::onOutputPageBeforeHTML';
diff --git a/i18n/en.json b/i18n/en.json
index a7088df..2434d92 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,5 +5,5 @@
         ]
     },
     "pubsubhubbub-desc": "Publishes changes to a PubSubHubbub hub",
-    "pushexport": "PubSubHubbub export"
+    "pubsubhubbub-export": "PubSubHubbub export"
 }
diff --git a/specials/SpecialPuSHExport.php 
b/specials/SpecialPubSubHubbubExport.php
similarity index 97%
rename from specials/SpecialPuSHExport.php
rename to specials/SpecialPubSubHubbubExport.php
index 7d48f87..6fa876f 100644
--- a/specials/SpecialPuSHExport.php
+++ b/specials/SpecialPubSubHubbubExport.php
@@ -17,7 +17,7 @@
 use Xml;
 use XmlDumpWriter;
 
-class SpecialPuSHExport extends SpecialPage {
+class SpecialPubSubhubbubExport extends SpecialPage {
 
        /**
         * @var WikiExporter
@@ -50,7 +50,7 @@
         * Constructor
         */
        public function __construct() {
-               parent::__construct( 'PuSHExport', '', false );
+               parent::__construct( 'PubSubhubbub-Export', '', false );
                $this->writer = new XmlDumpWriter();
                $this->sink = new DumpOutput();
                $this->dbr = wfGetDB( DB_SLAVE );
diff --git a/tests/phpunit/PubSubHubbubTest.php 
b/tests/phpunit/PubSubHubbubTest.php
index 3a29cf0..365fc15 100644
--- a/tests/phpunit/PubSubHubbubTest.php
+++ b/tests/phpunit/PubSubHubbubTest.php
@@ -51,15 +51,18 @@
         *
         * @param Article $article The modified Article from the Edit.
         * @param Revision|null $revision The revision (or null) the edit was 
based on.
-        * @param int $count The expected number of jobs in the database.
         */
-       public function testOnNewRevisionFromEditComplete( Article $article, 
$revision, $count ) {
+       public function testOnNewRevisionFromEditComplete( Article $article, 
$revision ) {
                $user = $this->getMock( 'User' );
                $baseRevId = 1;
+               $cond =  array( "job_cmd" => "PublishChanges" );
+
+               $dbr = wfGetDB( DB_SLAVE );
+               $count = $dbr->selectField( "job", "count(*)", $cond );
 
                PubSubHubbub::onNewRevisionFromEditComplete( $article, 
$revision, $baseRevId, $user);
-               $row = array( array( $count ) );
-               $this->assertSelect( "job", "count(*)", "", $row );
+               $row = array( array( $count + 1 ) );
+               $this->assertSelect( "job", "count(*)", $cond, $row );
        }
 
        /**
@@ -72,7 +75,7 @@
                global $wgScript, $wgServer, $wgPubSubHubbubHubURL;
                $title = Title::newFromText( $titleText );
 
-               $titleURL = $wgServer . $wgScript . "/Special:PuSHExport/" . 
$urlText;
+               $titleURL = $wgServer . $wgScript . 
"/Special:PubSubHubbub-Export/" . $urlText;
                $linkHeader = "Link: <" . $wgPubSubHubbubHubURL . ">; 
rel=\"hub\", <" . $titleURL . ">; rel=\"self\"";
                $this->assertEquals( $linkHeader, 
PubSubHubbub::createLinkHeader( $wgPubSubHubbubHubURL, $title ) );
        }
@@ -90,7 +93,7 @@
                        $ns = NamespaceUtils::getEntityNamespace( $nsModel );
                        $title = Title::newFromText( $titleText, $ns );
 
-                       $titleURL = $wgServer . $wgScript . 
"/Special:PuSHExport/" . $urlText;
+                       $titleURL = $wgServer . $wgScript . 
"/Special:PubSubHubbub-Export/" . $urlText;
                        $linkHeader = "Link: <" . $wgPubSubHubbubHubURL . ">; 
rel=\"hub\", <" . $titleURL . ">; rel=\"self\"";
 
                        $this->assertEquals( $linkHeader, 
PubSubHubbub::createLinkHeader( $wgPubSubHubbubHubURL, $title ) );
@@ -116,7 +119,7 @@
        /**
         * The provider of data for testOnPageContentSaveComplete.
         *
-        * @return array[array[Article, Revision|null, int]]
+        * @return array[array[Article, Revision]]
         */
        public function contentSaveData() {
                $data = array();
@@ -127,12 +130,12 @@
                $revision = new Revision( array(
                        'id' => 1,
                ) );
-               $data[] = array( $article, $revision, 1 );
+               $data[] = array( $article, $revision );
 
                $revision = new Revision( array(
                        'id' => 100,
                ) );
-               $data[] = array( $article, $revision, 2 );
+               $data[] = array( $article, $revision );
 
                return $data;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a5df39acda1f3a5770bb317a4791ddf609bd02d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PubSubHubbub
Gerrit-Branch: master
Gerrit-Owner: Alexander.lehmann <alexander.lehm...@student.hpi.uni-potsdam.de>
Gerrit-Reviewer: Nik <sebastian.brueck...@student.hpi.uni-potsdam.de>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to