#!/bin/sh

set +x

# generate outoload-files. keep in sync with debian/rules::override_dh_auto_build
phpab --template debian/autoload.php.tpl \
  --output autoload.php \
  libraries/classes \
  setup/lib
phpab --template debian/autoload-test.php.tpl \
  --output test/autoload.php \
  test

# TODO: investigate why the build is working
rm -rf test/selenium

# keep in sync with debian/rules::override_dh_auto_test
find test/ -type f -print0 | xargs -0 sed -i 's/function setUpBeforeClass()/function setUpBeforeClass(): void/g'
find test/ -type f -print0 | xargs -0 sed -i 's/function setUp()/function setUp(): void/g'
find test/ -type f -print0 | xargs -0 sed -i 's/function tearDown()/function tearDown(): void/g'
LC_ALL=en_US.UTF-8 phpunit --config phpunit.xml.nocoverage --exclude-group selenium,network,git-revision,environment,extension-iconv
find test/ -type f -print0 | xargs -0 sed -i 's/function setUpBeforeClass(): void/function setUpBeforeClass()/g'
find test/ -type f -print0 | xargs -0 sed -i 's/function setUp(): void/function setUp()/g'
find test/ -type f -print0 | xargs -0 sed -i 's/function tearDown(): void/function tearDown()/g'

