#!/bin/sh

set -eu

SKIP_32_BIT="$(php -n -r "echo (PHP_INT_SIZE === 4 || php_uname('m') === 's390x') ? '--exclude-group 32bit-incompatible' : '';")"

phpabtpl --require mikey179/vfsstream --require-file /usr/share/php/phing/autoload.php 2>/dev/null 1> debian/autoload-tests.php.tpl

mkdir -p vendor
phpab --output vendor/autoload.php \
	--template debian/autoload-tests.php.tpl tests/

PHING_AUTOLOAD="vendor/autoload.php" \
PHING_SOURCE="/usr/share/php/phing/" \
	phpunit \
		-d intl.default_locale=en \
		--no-coverage \
		--do-not-cache-result \
		--display-skipped \
		--configuration tests/phpunit.xml $SKIP_32_BIT
