Make phpunit on Ubuntu work out-of-the-box (at least for me) and prepare for some...
authorMark A. Hershberger <mah@users.mediawiki.org>
Tue, 5 Jan 2010 04:34:44 +0000 (04:34 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Tue, 5 Jan 2010 04:34:44 +0000 (04:34 +0000)
tests/LocalFileTest.php
tests/README.ALTERNATIVE [new file with mode: 0644]
tests/SearchEngineTest.php
tests/SearchMySQL4Test.php
tests/bootstrap.php [new file with mode: 0644]
tests/phpunit.xml [new file with mode: 0644]

index 335b8bb..4b6fde4 100644 (file)
@@ -2,6 +2,7 @@
 
 /**
  * These tests should work regardless of $wgCapitalLinks
+ * @group Broken
  */
 
 class LocalFileTest extends PHPUnit_Framework_TestCase {
diff --git a/tests/README.ALTERNATIVE b/tests/README.ALTERNATIVE
new file mode 100644 (file)
index 0000000..364d5e3
--- /dev/null
@@ -0,0 +1,24 @@
+This file describes an alternative way of testing from that in README
+since the README method didn't work for me.
+
+ - Put a LocalSettings.php in the parent directory.  If you checked
+   out mediawiki/trunk/phase3 as a directory called mediawiki, then
+   this would go in your 
+ - Install PHPUnit.  I used version 3.3.16 from Ubuntu.
+   ("aptitude install phpunit").
+ - Invoke phpunit directly instead of using make.  This uses the
+   phpunit.xml file to run the tests.
+ - Fix broken tests.
+ - Label currently broken tests in the group Broken and they will not
+   be run by phpunit.  You can add them to the group by putting the
+   following comment at the top of the file:
+
+    /**
+     * @group Broken
+     */
+
+
+
+NOTE: I haven't yet determined why but my PHP installation would
+sometimes segfault while linting the files.  PHPUnit uses "php -l" to
+check file syntax.
index 4fc4b2f..8193496 100644 (file)
@@ -2,7 +2,10 @@
 
 require_once 'MediaWiki_TestCase.php';
 
-/** @todo document */
+/** @todo document
+ * @group Broken
+ */
+
 class SearchEngineTest extends MediaWiki_TestCase {
        var $db, $search;
 
index 4fe4d54..ffb41bf 100644 (file)
@@ -1,6 +1,10 @@
 <?php
 require_once( 'SearchEngineTest.php' );
 
+/**
+ * @group Broken
+ */
+
 class SearchMySQL4Test extends SearchEngineTest {
        var $db;
 
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644 (file)
index 0000000..234d01c
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+$IP = realpath(dirname( __FILE__ ) . '/..');
+define('MEDIAWIKI', 1);
+global $optionsWithArgs;
+$optionsWithArgs = array();
+
+require_once( '../maintenance/commandLine.inc' );
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
new file mode 100644 (file)
index 0000000..457c23e
--- /dev/null
@@ -0,0 +1,16 @@
+<!-- See http://www.phpunit.de/manual/3.3/en/appendixes.configuration.html -->
+<phpunit bootstrap="./bootstrap.php"
+         colors="false"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         stopOnFailure="true">
+  <testsuite name="MediaWiki Test Suite">
+    <directory>.</directory>
+  </testsuite>
+  <groups>
+    <exclude>
+      <group>Broken</group>
+    </exclude>
+  </groups>
+</phpunit>
\ No newline at end of file