#!/bin/bash # This script sets-up the test environment and runs all tests. # You'll want to define your local mysql credentials for a test # database as environment variables, e.g., in ~/.bash_profile: # export DB_NAME="test" # export DB_USER="test" # export DB_PASS="..." # Be in the directory with all the tests. cd `dirname $0`; # Get required ENV variables. if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then 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 while [[ -z ${!E} ]]; do read -p "$E: " $E; done export $E; done # Create database. mysql -e 'CREATE DATABASE IF NOT EXISTS `test`'; # Go! echo "Running the tests!"; echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors."; # Config options go in phpunit.xml # phpunit --tap | grep -v '^ok ' phpunit --stderr