Addshore has uploaded a new change for review.

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


Change subject: Add basic inputfield tests for Set* Specialpages
......................................................................

Add basic inputfield tests for Set* Specialpages

SetAliases,SetDescription,SetLabel,SetSitelink

Change-Id: If6fb2bab0bbaac39176dd0a39bf02ee6b76b7dfc
---
M repo/tests/phpunit/includes/specials/SpecialSetAliasesTest.php
M repo/tests/phpunit/includes/specials/SpecialSetDescriptionTest.php
M repo/tests/phpunit/includes/specials/SpecialSetLabelTest.php
A repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
4 files changed, 155 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/19/78519/2

diff --git a/repo/tests/phpunit/includes/specials/SpecialSetAliasesTest.php 
b/repo/tests/phpunit/includes/specials/SpecialSetAliasesTest.php
index 2307e95..114d7a4 100644
--- a/repo/tests/phpunit/includes/specials/SpecialSetAliasesTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialSetAliasesTest.php
@@ -48,8 +48,32 @@
 
                //TODO: Verify that item creation works via a faux post request
 
+               $expectedInputs = array(
+                       'id' => array(
+                               'id' => 'wb-setentity-id',
+                               'class' => 'wb-input',
+                               'name' => 'id' ),
+                       'language' => array(
+                               'id' => 'wb-setentity-language',
+                               'class' => 'wb-input',
+                               'name' => 'language' ),
+                       'value' => array(
+                               'id' => 'wb-setentity-value',
+                               //@todo the below class does not look correct
+                               'class' => 'wb-input',
+                               'name' => 'value' ),
+                       'submit' => array(
+                               'id' => 'wb-setaliases-submit',
+                               'class' => 'wb-button',
+                               'type' => 'submit',
+                               'name' => 'wikibase-setaliases-submit' ),
+               );
+
                list( $output, ) = $this->executeSpecialPage( '' );
-               $this->assertTrue( true, 'Calling execute without any subpage 
value' );
+
+               foreach( $expectedInputs as $input ){
+                       $this->assertHasHtmlTagWithElements( $output, 'input', 
$input );
+               }
        }
 
 }
\ No newline at end of file
diff --git a/repo/tests/phpunit/includes/specials/SpecialSetDescriptionTest.php 
b/repo/tests/phpunit/includes/specials/SpecialSetDescriptionTest.php
index 7751712..459cb34 100644
--- a/repo/tests/phpunit/includes/specials/SpecialSetDescriptionTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialSetDescriptionTest.php
@@ -48,8 +48,32 @@
 
                //TODO: Verify that item creation works via a faux post request
 
+               $expectedInputs = array(
+                       'id' => array(
+                               'id' => 'wb-setentity-id',
+                               'class' => 'wb-input',
+                               'name' => 'id' ),
+                       'language' => array(
+                               'id' => 'wb-setentity-language',
+                               'class' => 'wb-input',
+                               'name' => 'language' ),
+                       'value' => array(
+                               'id' => 'wb-setentity-value',
+                               //@todo the below class does not look correct
+                               'class' => 'wb-input',
+                               'name' => 'value' ),
+                       'submit' => array(
+                               'id' => 'wb-setdescription-submit',
+                               'class' => 'wb-button',
+                               'type' => 'submit',
+                               'name' => 'wikibase-setdescription-submit' ),
+               );
+
                list( $output, ) = $this->executeSpecialPage( '' );
-               $this->assertTrue( true, 'Calling execute without any subpage 
value' );
+
+               foreach( $expectedInputs as $input ){
+                       $this->assertHasHtmlTagWithElements( $output, 'input', 
$input );
+               }
        }
 
 }
\ No newline at end of file
diff --git a/repo/tests/phpunit/includes/specials/SpecialSetLabelTest.php 
b/repo/tests/phpunit/includes/specials/SpecialSetLabelTest.php
index 762e69a..67f344e 100644
--- a/repo/tests/phpunit/includes/specials/SpecialSetLabelTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialSetLabelTest.php
@@ -48,8 +48,32 @@
 
                //TODO: Verify that item creation works via a faux post request
 
+               $expectedInputs = array(
+                       'id' => array(
+                               'id' => 'wb-setentity-id',
+                               'class' => 'wb-input',
+                               'name' => 'id' ),
+                       'language' => array(
+                               'id' => 'wb-setentity-language',
+                               'class' => 'wb-input',
+                               'name' => 'language' ),
+                       'value' => array(
+                               'id' => 'wb-setentity-value',
+                               //@todo the below class does not look correct
+                               'class' => 'wb-input',
+                               'name' => 'value' ),
+                       'submit' => array(
+                               'id' => 'wb-setlabel-submit',
+                               'class' => 'wb-button',
+                               'type' => 'submit',
+                               'name' => 'wikibase-setlabel-submit' ),
+               );
+
                list( $output, ) = $this->executeSpecialPage( '' );
-               $this->assertTrue( true, 'Calling execute without any subpage 
value' );
+
+               foreach( $expectedInputs as $input ){
+                       $this->assertHasHtmlTagWithElements( $output, 'input', 
$input );
+               }
        }
 
 }
\ No newline at end of file
diff --git a/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php 
b/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
new file mode 100644
index 0000000..a5dabec
--- /dev/null
+++ b/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
@@ -0,0 +1,80 @@
+<?php
+
+namespace Wikibase\Test;
+use SpecialSetSiteLink;
+
+/**
+ * Tests for the SpecialSetSitelink 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 0.4
+ *
+ * @ingroup WikibaseRepoTest
+ * @ingroup Test
+ *
+ * @group Wikibase
+ * @group SpecialPage
+ * @group WikibaseSpecialPage
+ *
+ * @licence GNU GPL v2+
+ * @author Adam Shorland
+ */
+class SpecialSetSitelinkTest extends SpecialPageTestBase {
+
+       protected function newSpecialPage() {
+               return new SpecialSetSitelink();
+       }
+
+       public function testExecute() {
+               //TODO: Actually verify that the output is correct.
+               //      Currently this just tests that there is no fatal error,
+               //      and that the restriction handling is working and doesn't
+               //      block. That is, the default should let the user execute
+               //      the page.
+
+               //TODO: Verify that item creation works via a faux post request
+
+               $expectedInputs = array(
+                       'id' => array(
+                               'id' => 'wb-setentity-id',
+                               'class' => 'wb-input',
+                               'name' => 'id' ),
+                       'site' => array(
+                               'id' => 'wb-setsitelink-site',
+                               'class' => 'wb-input',
+                               'name' => 'site' ),
+                       'page' => array(
+                               'id' => 'wb-setsitelink-page',
+                               //@todo the below class does not look correct
+                               'class' => 'wb-input wb-input-text',
+                               'name' => 'page' ),
+                       'submit' => array(
+                               'id' => 'wb-setsitelink-submit',
+                               'class' => 'wb-button',
+                               'type' => 'submit',
+                               'name' => 'wikibase-setsitelink-submit' ),
+               );
+
+               list( $output, ) = $this->executeSpecialPage( '' );
+
+               foreach( $expectedInputs as $input ){
+                       $this->assertHasHtmlTagWithElements( $output, 'input', 
$input );
+               }
+       }
+
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6fb2bab0bbaac39176dd0a39bf02ee6b76b7dfc
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to