source: branches/eli_branch/tests/run_tests.sh @ 447

Last change on this file since 447 was 446, checked in by anonymous, 11 years ago

Wrapper script for phpunit. Changed logMsg SCREEN action to print to stderr.

File size: 937 bytes
Line 
1#!/bin/sh
2
3# This script sets-up the test environment and runs all tests.
4# You'll want to define your local mysql credentials for a test
5# database as environment variables, e.g., in ~/.bash_profile:
6#  export DB_NAME="test"
7#  export DB_USER="test"
8#  export DB_PASS="..."
9
10# Be in the directory with all the tests.
11cd `dirname $0`;
12
13# Get required ENV variables.
14if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then
15    echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time.";
16fi
17for E in DB_USER DB_PASS DB_NAME; do
18    while [[ -z ${!E} ]]; do
19        read -p "$E: " $E;
20    done
21    export $E;
22done
23
24# Create database.
25mysql -e 'CREATE DATABASE IF NOT EXISTS `test`';
26
27# Go!
28echo "Running the tests!";
29echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors.";
30
31# Config options go in phpunit.xml
32# phpunit --tap | grep -v '^ok '
33phpunit
Note: See TracBrowser for help on using the repository browser.