From ab8953081944a3b6aadf53c6e874deb87a951a67 Mon Sep 17 00:00:00 2001 From: Florian Schlichting Date: Mon, 13 Mar 2023 21:56:13 +0100 Subject: [PATCH] add Debian autopkgtests --- debian/tests/control | 3 +++ debian/tests/phpunit | 8 ++++++++ debian/tests/syntax | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 debian/tests/control create mode 100755 debian/tests/phpunit create mode 100755 debian/tests/syntax diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 00000000..7b0b14f0 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +# https://people.debian.org/~eriberto/README.package-tests.html +Tests: syntax, phpunit +Depends: davical, php-cli, phpunit diff --git a/debian/tests/phpunit b/debian/tests/phpunit new file mode 100755 index 00000000..af88450b --- /dev/null +++ b/debian/tests/phpunit @@ -0,0 +1,8 @@ +#!/bin/bash +# run our test suite, but on the installed package + +set -e + +# 2) phpunit tests +phpunit --include-path "/usr/share/davical:/usr/share/awl" testing/phpunit + diff --git a/debian/tests/syntax b/debian/tests/syntax new file mode 100755 index 00000000..1e5c7134 --- /dev/null +++ b/debian/tests/syntax @@ -0,0 +1,19 @@ +#!/bin/bash +# run our test suite, but on the installed package + +set -e + +# 1) simple php syntax check +for PHP in /usr/share/davical/htdocs/*.php /usr/share/davical/inc/*.php +do + php -l ${PHP} >> $AUTOPKGTEST_TMP/test-syntax +done + +if grep -v 'No syntax errors detected' $AUTOPKGTEST_TMP/test-syntax +then + cat $AUTOPKGTEST_TMP/test-syntax + exit 1 +else + echo "OK (Syntax checked)"; +fi +rm $AUTOPKGTEST_TMP/test-syntax