r95398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95397‎ | r95398 | r95399 >
Date:13:10, 24 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added test file
Modified paths:
  • /trunk/extensions/Survey/Survey.hooks.php (modified) (history)
  • /trunk/extensions/Survey/Survey.php (modified) (history)
  • /trunk/extensions/Survey/test (added) (history)
  • /trunk/extensions/Survey/test/SurveyQuestionTest.php (added) (history)

Diff [purge]

Index: trunk/extensions/Survey/test/SurveyQuestionTest.php
@@ -0,0 +1,27 @@
 2+<?php
 3+
 4+/**
 5+ * SurveyQuestion test case.
 6+ *
 7+ * @ingroup Survey
 8+ * @since 0.1
 9+ *
 10+ * @licence GNU GPL v3
 11+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 12+ */
 13+class SurveyQuestionTest extends MediaWikiTestCase {
 14+
 15+ /**
 16+ * Tests SurveyQuestion::newFromUrlData and SurveyQuestion::toUrlData
 17+ */
 18+ public function testQuestionUrlSerialization() {
 19+ $question = new SurveyQuestion( 9001, 42, 'ohai there!', 0, true );
 20+
 21+ $this->assertEquals(
 22+ $question,
 23+ SurveyQuestion::newFromUrlData( $question->toUrlData() ),
 24+ "Serializaion test failed at " . __METHOD__
 25+ );
 26+ }
 27+
 28+}
Property changes on: trunk/extensions/Survey/test/SurveyQuestionTest.php
___________________________________________________________________
Added: svn:eol-style
129 + native
Index: trunk/extensions/Survey/Survey.php
@@ -82,6 +82,7 @@
8383 $wgAPIListModules['surveys'] = 'ApiQuerySurveys';
8484
8585 $wgHooks['LoadExtensionSchemaUpdates'][] = 'SurveyHooks::onSchemaUpdate';
 86+$wgHooks['UnitTestsList'][] = 'SurveyHooks::registerUnitTests';
8687
8788 $wgAvailableRights[] = 'surveyadmin';
8889 $wgAvailableRights[] = 'surveysubmit';
Index: trunk/extensions/Survey/Survey.hooks.php
@@ -60,4 +60,19 @@
6161 return true;
6262 }
6363
 64+ /**
 65+ * Hook to add PHPUnit test cases.
 66+ *
 67+ * @since 0.1
 68+ *
 69+ * @param array $files
 70+ */
 71+ public static function registerUnitTests( array &$files ) {
 72+ $testDir = dirname( __FILE__ ) . '/test/';
 73+
 74+ $files[] = $testDir . 'SurveyQuestionTest.php';
 75+
 76+ return true;
 77+ }
 78+
6479 }

Status & tagging log