#!/bin/sh
set -eu

export DEBUG=true
export LOG_DRIVER=file
export LOG_FILE="$AUTOPKGTEST_ARTIFACTS/kanboard_debug.log"

cp -a composer.json tests "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
ln -s /usr/share/kanboard/app
ln -s /usr/share/kanboard/vendor
ln -s /etc/kanboard/config.php
touch "$LOG_FILE"
phpabtpl --require symfony/stopwatch --require-file vendor/autoload.php > autoload.tests.php.tpl 2>&1
phpab --output autoload.tests.php --template autoload.tests.php.tpl tests/units
phpunit \
    --configuration tests/units.sqlite.xml \
    --bootstrap autoload.tests.php \
    --do-not-cache-result \
    --display-deprecations \
    --display-phpunit-deprecations
