Addshore has uploaded a new change for review. https://gerrit.wikimedia.org/r/79196
Change subject: Add basic tests for EntitiesWithout* special pages ...................................................................... Add basic tests for EntitiesWithout* special pages Change-Id: I813f41093f676521972e3d6e6e64ab8e3fb35f04 --- M repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutDescriptionTest.php M repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutLabelTest.php 2 files changed, 38 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/96/79196/1 diff --git a/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutDescriptionTest.php b/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutDescriptionTest.php index 0d84539..9b6b5e4 100644 --- a/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutDescriptionTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutDescriptionTest.php @@ -32,6 +32,7 @@ * * @licence GNU GPL v2+ * @author Bene* < benestar.wikime...@googlemail.com > + * @author Adam Shorland */ class SpecialEntitiesWithoutDescriptionTest extends SpecialPageTestBase { @@ -40,14 +41,27 @@ } 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. + + $matchers['language'] = array( + 'tag' => 'input', + 'attributes' => array( + 'id' => 'wb-entitieswithoutpage-language', + 'name' => 'language', + ) ); + $matchers['submit'] = array( + 'tag' => 'input', + 'attributes' => array( + 'id' => 'wikibase-entitieswithoutpage-submit', + 'class' => 'wb-input-button', + 'type' => 'submit', + 'name' => 'submit', + ) ); + list( $output, ) = $this->executeSpecialPage( '' ); - $this->assertTrue( true, 'Calling execute without any subpage value' ); + foreach( $matchers as $key => $matcher ){ + $this->assertTag( $matcher, $output, "Failed to match html output with tag '{$key}''" ); + } list( $output, ) = $this->executeSpecialPage( 'en' ); $this->assertTrue( true, 'Calling execute with a subpage value' ); //TODO: assert output diff --git a/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutLabelTest.php b/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutLabelTest.php index f570b99..27a5712 100644 --- a/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutLabelTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialEntitiesWithoutLabelTest.php @@ -41,14 +41,26 @@ } 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. + + $matchers['language'] = array( + 'tag' => 'input', + 'attributes' => array( + 'id' => 'wb-entitieswithoutpage-language', + 'name' => 'language', + ) ); + $matchers['submit'] = array( + 'tag' => 'input', + 'attributes' => array( + 'id' => 'wikibase-entitieswithoutpage-submit', + 'class' => 'wb-input-button', + 'type' => 'submit', + 'name' => 'submit', + ) ); list( $output, ) = $this->executeSpecialPage( '' ); - $this->assertTrue( true, 'Calling execute without any subpage value' ); + foreach( $matchers as $key => $matcher ){ + $this->assertTag( $matcher, $output, "Failed to match html output with tag '{$key}''" ); + } } } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/79196 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I813f41093f676521972e3d6e6e64ab8e3fb35f04 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits