[TESTS] Add test container with Xdebug and allow for generation of coverage reports with 'make test'

This commit is contained in:
Hugo Sales 2021-05-02 12:39:32 +00:00
parent 091f4b5194
commit ee97cc5b00
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
7 changed files with 32 additions and 1 deletions

View File

@ -3,3 +3,4 @@ KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
DATABASE_URL=postgresql://postgres:password@db:5432/social

5
.gitignore vendored
View File

@ -52,4 +52,7 @@ social.local.yaml
config.php
/file
notes
notes
.test_coverage_report

3
Makefile Normal file
View File

@ -0,0 +1,3 @@
test:
cd docker/testing && docker-compose run php

View File

@ -6,6 +6,12 @@ echo "Got response from DB"
for script in /var/entrypoint.d/*.sh; do
$script
ret=$?
if [ $ret -eq 64 ]; then
exit 0
elif [ $ret -eq 65 ]; then
exit 1
fi
done
exec php-fpm

View File

@ -0,0 +1,8 @@
FROM gsocial/php
WORKDIR /var/www/social
RUN apk update \
&& apk add --no-cache $PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug

7
docker/testing/coverage.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if /var/www/social/bin/phpunit --coverage-html .test_coverage_report; then
exit 64
else
exit 65
fi

View File

@ -0,0 +1,3 @@
zend_extension=xdebug
xdebug.mode=develop,coverage