diff --git a/drydocker/kolab-hkccp/test_functional.sh b/drydocker/kolab-hkccp/test_functional.sh new file mode 100755 index 0000000..a42d598 --- /dev/null +++ b/drydocker/kolab-hkccp/test_functional.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +pushd /srv/${PACKAGE}.git + +# install and configure mysql +yum -y install mariadb mariadb-server GeoIP + +systemctl -q is-active mariadb.service || (systemctl start mariadb.service && sleep 5) + +MYSQL_PASSWORD="12345" +mysqladmin -u root password $MYSQL_PASSWORD + +mysql -uroot -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS hkccp_test;" +mysql -uroot -p$MYSQL_PASSWORD -e "CREATE DATABASE hkccp_test; GRANT ALL PRIVILEGES ON hkccp_test.* TO 'kolab'@'localhost' IDENTIFIED BY 'Welcome2KolabSystems'; FLUSH PRIVILEGES;" +mysql -uroot -p$MYSQL_PASSWORD hkccp_test < SQL/mysql.sql + +# configure the mockup API endpoint in Apache +( + echo "Alias /hkccp-test /srv/${PACKAGE}.git/tests" + echo "" + echo " Options +FollowSymLinks" + echo " AllowOverride All" + echo " " + echo " Require all granted" + echo " " + echo "" +) > /etc/httpd/conf.d/hkccp-test.conf + +systemctl restart httpd.service + +# configure HKCCP test environment +mkdir -p temp +mkdir -p log +chown apache temp log +chmod 0774 temp log + +cp config/config.ini.sample config/config.ini +cp tests/config-test.ini config/config-test.ini + +# create data files +echo " temp/exchange_rates.php +echo " temp/countries.php + +# execute the tests +for group in SQL API Model Controller; do + phpunit --debug --configuration tests/phpunit.xml --testsuite $group + retval=$? + + if [ ${retval} -ne 0 ]; then + echo "FAILED functional tests $group." + exit 1 + fi +done + +popd diff --git a/drydocker/kolab-hkccp/test_unit.sh b/drydocker/kolab-hkccp/test_unit.sh index 4384428..4f9a94d 100755 --- a/drydocker/kolab-hkccp/test_unit.sh +++ b/drydocker/kolab-hkccp/test_unit.sh @@ -1,12 +1,11 @@ #!/bin/bash pushd /srv/${PACKAGE}.git phpunit --debug --configuration tests/phpunit.xml --testsuite Unit ; retval=$? if [ ${retval} -ne 0 ]; then echo "FAILED unit tests." exit 1 fi popd -popd