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 |
1 | 29 | + native |
Index: trunk/extensions/Survey/Survey.php |
— | — | @@ -82,6 +82,7 @@ |
83 | 83 | $wgAPIListModules['surveys'] = 'ApiQuerySurveys'; |
84 | 84 | |
85 | 85 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'SurveyHooks::onSchemaUpdate'; |
| 86 | +$wgHooks['UnitTestsList'][] = 'SurveyHooks::registerUnitTests'; |
86 | 87 | |
87 | 88 | $wgAvailableRights[] = 'surveyadmin'; |
88 | 89 | $wgAvailableRights[] = 'surveysubmit'; |
Index: trunk/extensions/Survey/Survey.hooks.php |
— | — | @@ -60,4 +60,19 @@ |
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
| 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 | + |
64 | 79 | } |