Index: trunk/tests/_config.inc.php
===================================================================
--- trunk/tests/_config.inc.php	(revision 547)
+++ trunk/tests/_config.inc.php	(revision 599)
@@ -28,4 +28,5 @@
 */
 require_once '../lib/App.inc.php';
+require_once '../lib/DB.inc.php';
 
 $app =& App::getInstance('testapp');
@@ -44,5 +45,5 @@
     'db_debug' => true,
     'db_die_on_failure' => true,
-    'db_server' => 'localhost',
+    'db_server' => getenv('DB_SERVER'),
     'db_name' => getenv('DB_NAME'),
     'db_user' => getenv('DB_USER'),
Index: trunk/tests/phpunit.xml
===================================================================
--- trunk/tests/phpunit.xml	(revision 547)
+++ trunk/tests/phpunit.xml	(revision 599)
@@ -1,9 +1,10 @@
-<!--
-For config options see:
-http://phpunit.de/manual/current/en/appendixes.configuration.html
-
-Run all scripts by executing ./run_tests.sh
--->
-<phpunit
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
+backupGlobals="false"
+beStrictAboutCoversAnnotation="true"
+beStrictAboutOutputDuringTests="true"
+beStrictAboutTestsThatDoNotTestAnything="true"
+beStrictAboutTodoAnnotatedTests="true"
 convertErrorsToExceptions="false"
 convertNoticesToExceptions="false"
@@ -21,19 +22,23 @@
     <includePath>.</includePath>
     <includePath>/opt</includePath>
-    <testsuites>
-        <testsuite name="Codebase_Tests">
-            <file>AppTest.php</file>
-            <file>AuthFileTest.php</file>
-<!--        <file>AuthorizeNetTest.php</file> -->
-            <file>AuthSQLTest.php</file>
-            <file>CSSTest.php</file>
-            <file>DBSessionHandlerTest.php</file>
-            <file>EmailTest.php</file>
-            <file>FormValidatorTest.php</file>
-            <file>LockTest.php</file>
-            <file>PayPalTest.php</file>
-            <file>VersionTest.php</file>
-            <file>UtilitiesTest.php</file>
-        </testsuite>
-    </testsuites>
+    <testsuite>
+        <file>AppTest.php</file>
+        <!-- <file>AuthFileTest.php</file> -->
+        <!-- <file>AuthorizeNetTest.php</file> -->
+        <!-- <file>AuthSQLTest.php</file> -->
+        <!-- <file>CSSTest.php</file> -->
+        <!-- <file>DBSessionHandlerTest.php</file> -->
+        <!-- <file>EmailTest.php</file> -->
+        <!-- <file>FormValidatorTest.php</file> -->
+        <!-- <file>LockTest.php</file> -->
+        <!-- <file>PayPalTest.php</file> -->
+        <!-- <file>VersionTest.php</file> -->
+        <!-- <file>UtilitiesTest.php</file> -->
+    </testsuite>
+
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="true">
+            <directory suffix=".php">src</directory>
+        </whitelist>
+    </filter>
 </phpunit>
Index: trunk/tests/run_tests.sh
===================================================================
--- trunk/tests/run_tests.sh	(revision 547)
+++ trunk/tests/run_tests.sh	(revision 599)
@@ -8,4 +8,11 @@
 #  export DB_PASS="..."
 
+function err {
+    MSG="$1";
+    IFS='';
+    echo -e $MSG 1>&2
+    exit 1;
+}
+
 # Be in the directory with all the tests.
 cd `dirname $0`;
@@ -15,5 +22,5 @@
     echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time.";
 fi
-for E in DB_USER DB_PASS DB_NAME; do
+for E in DB_SERVER DB_NAME DB_USER DB_PASS; do
     while [[ -z ${!E} ]]; do
         read -p "$E: " $E;
@@ -23,5 +30,5 @@
 
 # Create database.
-mysql -e 'CREATE DATABASE IF NOT EXISTS `test`';
+mysql -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\`" || err "Failed to create database '${DB_NAME}";
 
 # Go!
@@ -31,3 +38,4 @@
 # Config options go in phpunit.xml
 # phpunit --tap | grep -v '^ok '
-phpunit --stderr || echo "Something went wrong (if there is no output above, check the php_error_log)";
+phpunit --stderr --colors --debug || err "\nSomething went wrong (code $?). If there is no output above, check the php_error_log";
+
