jenkins-bot has submitted this change and it was merged.

Change subject: (Bug 47010) Add regression test
......................................................................


(Bug 47010) Add regression test

Change-Id: Ic15c0f9c3ce40bddeda65cab0200584054a0506e
---
M SemanticMediaWiki.hooks.php
A tests/phpunit/includes/InfolinkTest.php
2 files changed, 87 insertions(+), 0 deletions(-)

Approvals:
  Mwjames: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 6a57b07..d614712 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -276,6 +276,7 @@
                        'ParserParameterFormatter',
                        'Subobject',
                        'RecurringEvents',
+                       'Infolink',
 
                        'dataitems/DI_Blob',
                        'dataitems/DI_Bool',
diff --git a/tests/phpunit/includes/InfolinkTest.php 
b/tests/phpunit/includes/InfolinkTest.php
new file mode 100644
index 0000000..3ef3662
--- /dev/null
+++ b/tests/phpunit/includes/InfolinkTest.php
@@ -0,0 +1,86 @@
+<?php
+
+namespace SMW\Test;
+
+use SMWInfolink;
+
+/**
+ * Tests for the SMWInfolink class
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @since 1.9
+ *
+ * @ingroup SMW
+ * @ingroup Test
+ *
+ * @group SMW
+ * @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @author mwjames
+ */
+class InfolinkTest extends \MediaWikiTestCase {
+
+       /**
+        * Parameter dataProvider
+        *
+        * @return array
+        */
+       public function getParameterDataProvider() {
+               return array(
+                       array(
+                               // #0
+                               array(
+                                       'format=template',
+                                       'link=none'
+                               ),
+                               array(
+                                       'format=template/link=none',
+                                       'x=format%3Dtemplate%2Flink%3Dnone'
+                               )
+                       ),
+
+                       // #1 Bug 47010 (space encoding, named args => 
named%20args)
+                       array(
+                               array(
+                                       'format=template',
+                                       'link=none',
+                                       'named args=1'
+                               ),
+                               array(
+                                       
'format=template/link=none/named-20args=1',
+                                       
'x=format%3Dtemplate%2Flink%3Dnone%2Fnamed-20args%3D1'
+                               )
+                       ),
+               );
+       }
+
+       /**
+        * Test encode parameters
+        *
+        * @covers SMWInfolink::encodeParameters
+        * @dataProvider getParameterDataProvider
+        */
+       public function testEncodeParameters( array $params, array 
$expectedEncode ) {
+               $encodeResult = SMWInfolink::encodeParameters( $params, true );
+               $this->assertEquals( $expectedEncode[0], $encodeResult );
+
+               $encodeResult = SMWInfolink::encodeParameters( $params, false );
+               $this->assertEquals( $expectedEncode[1], $encodeResult );
+       }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic15c0f9c3ce40bddeda65cab0200584054a0506e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to