1#!/usr/bin/env bash 2 3if [ "$1" == 'full' ]; then 4 fulltest=1 5elif [ "$1" == 'each' ]; then 6 testeach=1 7else 8 fulltest=0 9fi 10 11PHP_VERSION=$(php -r "echo PHP_VERSION_ID;") 12 13echo 14echo -e "\033[33mBegin Unit Testing\033[0m" 15# Run the testing suite 16echo "Basic test suite:" 17php vendor/bin/phpunit tests/unit 18if [ $? -ne 0 ]; then 19 # Test failure 20 exit 1 21fi 22echo "With open_basedir enabled:" 23php -d open_basedir=`pwd` vendor/bin/phpunit tests/unit_with_basedir 24if [ $? -ne 0 ]; then 25 # Test failure 26 exit 1 27fi 28echo "With open_basedir enabled, allowing /dev:" 29php -d open_basedir=`pwd`:/dev vendor/bin/phpunit tests/unit_with_basedir 30if [ $? -ne 0 ]; then 31 # Test failure 32 exit 1 33fi 34echo "With mbstring.func_overload enabled:" 35php -d mbstring.func_overload=7 vendor/bin/phpunit tests/unit 36if [ $? -ne 0 ]; then 37 # Test failure 38 exit 1 39fi 40 41if [[ "$testeach" == "1" ]]; then 42 echo " CAPICOM:" 43 php vendor/bin/phpunit --bootstrap tests/specific/capicom.php tests/unit 44 echo " /dev/urandom:" 45 php vendor/bin/phpunit --bootstrap tests/specific/dev_urandom.php tests/unit 46 echo " libsodium:" 47 php vendor/bin/phpunit --bootstrap tests/specific/libsodium.php tests/unit 48 echo " mcrypt:" 49 php vendor/bin/phpunit --bootstrap tests/specific/mcrypt.php tests/unit 50fi 51 52# Should we perform full statistical analyses? 53if [[ "$fulltest" == "1" ]]; then 54 php vendor/bin/phpunit tests/full 55 if [ $? -ne 0 ]; then 56 # Test failure 57 exit 1 58 fi 59fi 60 61