mirror of
https://github.com/cytopia/devilbox.git
synced 2025-04-16 15:09:01 +00:00
Test against PHP Xdebug
This commit is contained in:
parent
008cb7c023
commit
4588948d0c
65
.tests/intra-tests/php-xdebug.sh
Executable file
65
.tests/intra-tests/php-xdebug.sh
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
|
||||
#
|
||||
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
|
||||
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
|
||||
#
|
||||
|
||||
|
||||
###
|
||||
### Xdebug available
|
||||
###
|
||||
|
||||
printf "[TEST] Xdebug available"
|
||||
# 1st Try
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
|
||||
# 2nd Try
|
||||
sleep 1
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
|
||||
# 3rd Try
|
||||
sleep 1
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
|
||||
printf "\r[FAIL] Xdebug available\n"
|
||||
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
|
||||
exit 1
|
||||
else
|
||||
printf "\r[OK] Xdebug available (3 rounds)\n"
|
||||
fi
|
||||
else
|
||||
printf "\r[OK] Xdebug available (2 rounds)\n"
|
||||
fi
|
||||
else
|
||||
printf "\r[OK] Xdebug available (1 round)\n"
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
### Xdebug default disabled
|
||||
###
|
||||
|
||||
printf "[TEST] Xdebug default disabled"
|
||||
# 1st Try
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
|
||||
# 2nd Try
|
||||
sleep 1
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
|
||||
# 3rd Try
|
||||
sleep 1
|
||||
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
|
||||
printf "\r[FAIL] Xdebug default disabled\n"
|
||||
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
|
||||
exit 1
|
||||
else
|
||||
printf "\r[OK] Xdebug default disabled (3 rounds)\n"
|
||||
fi
|
||||
else
|
||||
printf "\r[OK] Xdebug default disabled (2 rounds)\n"
|
||||
fi
|
||||
else
|
||||
printf "\r[OK] Xdebug default disabled (1 round)\n"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user