diff --git a/Math.hooks.php b/Math.hooks.php
index ab61f10..a70da28 100644
--- a/Math.hooks.php
+++ b/Math.hooks.php
@@ -162,4 +162,16 @@ class MathHooks {
$wgMathPath = '/images/math';
return true;
}
+
+ /**
+ * Links to the unit test files for the test cases.
+ *
+ * @param string $files
+ * @return boolean (true)
+ */
+ static function onRegisterUnitTests( &$files ) {
+ $testDir = __DIR__ . '/tests/';
+ $files = array_merge( $files, glob( "$testDir/*Test.php" ) );
+ return true;
+ }
}
diff --git a/Math.php b/Math.php
index 2f6ea2b..b083a79 100644
--- a/Math.php
+++ b/Math.php
@@ -119,6 +119,7 @@ $wgHooks['GetPreferences'][] = 'MathHooks::onGetPreferences';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpdates';
$wgHooks['ParserTestTables'][] = 'MathHooks::onParserTestTables';
$wgHooks['ParserTestParser'][] = 'MathHooks::onParserTestParser';
+$wgHooks['UnitTestsList'][] = 'MathHooks::onRegisterUnitTests';
$dir = dirname( __FILE__ ) . '/';
$wgAutoloadClasses['MathHooks'] = $dir . 'Math.hooks.php';
diff --git a/README b/README
index f7c6493..54123a8 100644
--- a/README
+++ b/README
@@ -7,3 +7,7 @@ This version (for MediaWiki 1.19) has some changes since previous versions:
See the README in the math subdirectory for more info on setting up the
low-level conversion tools.
+For testing your installation run
+php tests/phpunit/phpunit.php extensions/Math/tests/
+from your MediWiki home path.
+
diff --git a/tests/MathSourceTest.php b/tests/MathSourceTest.php
new file mode 100644
index 0000000..9f67ae1
--- /dev/null
+++ b/tests/MathSourceTest.php
@@ -0,0 +1,27 @@
+assertEquals('$ a+b $', $real
+ , "Rendering of a+b in plain Text mode");
+ }
+
+ /**
+ * Checks if newlines are converted to spaces correctly.
+ */
+ public function testNewLines(){
+ $real=MathRenderer::renderMath("a\n b",array(),MW_MATH_SOURCE);
+ $this->assertSame('$ a b $', $real
+ , "converting newlines to spaces");
+ }
+
+}
\ No newline at end of file