Last change
on this file since 631 was
622,
checked in by anonymous, 7 years ago
|
Add Email() sandbox mode. Add Email->send() test. Fix minor bugs.
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
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 | function err { |
---|
11 | MSG="$1"; |
---|
12 | IFS=''; |
---|
13 | echo -e $MSG 1>&2 |
---|
14 | exit 1; |
---|
15 | } |
---|
16 | |
---|
17 | # Be in the directory with all the tests. |
---|
18 | cd `dirname $0`; |
---|
19 | |
---|
20 | # Get required ENV variables. |
---|
21 | if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then |
---|
22 | echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time."; |
---|
23 | fi |
---|
24 | for E in DB_SERVER DB_NAME DB_USER DB_PASS; do |
---|
25 | while [[ -z ${!E} ]]; do |
---|
26 | read -p "$E: " $E; |
---|
27 | done |
---|
28 | export $E; |
---|
29 | done |
---|
30 | |
---|
31 | # Create database. |
---|
32 | mysql -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\`" || err "Failed to create database '${DB_NAME}"; |
---|
33 | |
---|
34 | # Go! |
---|
35 | echo "Running the tests!"; |
---|
36 | echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors."; |
---|
37 | |
---|
38 | # Config options go in phpunit.xml |
---|
39 | # phpunit --tap | grep -v '^ok ' |
---|
40 | ../vendor/phpunit/phpunit/composer/bin/phpunit --stderr || err "\nSomething went wrong (code $?). If there is no output above, check the php_error_log"; |
---|
41 | |
---|
Note: See
TracBrowser
for help on using the repository browser.