Test Frameworks according to chosen PHP version

This commit is contained in:
cytopia 2019-11-24 10:02:12 +01:00
parent b318da24c6
commit 49d6c68bb5
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 32 additions and 5 deletions

View File

@ -13,7 +13,7 @@ DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
. "${SCRIPT_PATH}/../scripts/.lib.sh"
RETRIES=10
DISABLED_VERSIONS=("5.2" "5.3" "7.4" "8.0")
DISABLED_VERSIONS=("5.3" "7.4" "8.0")
DISABLED_MYSQL_VERSIONS=("mysql-8.0" "percona-8.0")

View File

@ -54,7 +54,7 @@ DB_NAME="my_wp"
PROJECT_NAME="this-is-my-grepable-project-name"
# Setup Wordpress project
# Download Wordpress
run "docker-compose exec --user devilbox -T php bash -c ' \
rm -rf /shared/httpd/${VHOST} \
&& mkdir -p /shared/httpd/${VHOST} \
@ -62,6 +62,21 @@ run "docker-compose exec --user devilbox -T php bash -c ' \
&& ln -sf wordpress /shared/httpd/${VHOST}/htdocs'" \
"${RETRIES}" "${DVLBOX_PATH}"
# Switch to an earlier Wordpress version for older PHP versions
if [ "${PHP_VERSION}" = "5.3" ] || [ "${PHP_VERSION}" = "5.4" ] || [ "${PHP_VERSION}" = "5.5" ]; then
run "docker-compose exec --user devilbox -T php bash -c ' \
cd /shared/httpd/${VHOST}/wordpress \
&& git checkout 5.1.3'" \
"${RETRIES}" "${DVLBOX_PATH}"
# Checkout latest git tag
else
run "docker-compose exec --user devilbox -T php bash -c ' \
cd /shared/httpd/${VHOST}/wordpress \
&& git checkout \"\$(git tag | sort -V | tail -1)\"'" \
"${RETRIES}" "${DVLBOX_PATH}"
fi
# Setup Database
run "docker-compose exec --user devilbox -T php mysql -u root -h mysql --password=\"${MYSQL_ROOT_PASSWORD}\" -e \"DROP DATABASE IF EXISTS ${DB_NAME}; CREATE DATABASE ${DB_NAME};\"" "${RETRIES}" "${DVLBOX_PATH}"
@ -103,10 +118,22 @@ if ! run "docker-compose exec --user devilbox -T php curl -sS --fail -L -XPOST -
--data 'pw_weak=on' \
--data 'admin_email=test%40test.com' \
--data 'blog_public=0' \
--data 'Submit=Install+WordPress&language='" "1" "${DVLBOX_PATH}"
--data 'Submit=Install+WordPress' \
--data 'language='" "1" "${DVLBOX_PATH}"
exit 1
fi
# Test Wordpress
run "docker-compose exec --user devilbox -T php curl -sS --fail -L 'http://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}/' | grep '${PROJECT_NAME}' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"
run " curl -sS --fail -L --header 'host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/' | grep '${PROJECT_NAME}' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail -L 'http://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}/' | grep '${PROJECT_NAME}' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec --user devilbox -T php curl -sS -L 'http://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}/'" "1" "${DVLBOX_PATH}" || true
exit 1
fi
if ! run "curl -sS --fail -L --header 'host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/' | grep '${PROJECT_NAME}' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"; then
run "curl -sS -L --header 'host: ${VHOST}.${TLD_SUFFIX}' 'http://localhost:${HOST_PORT_HTTPD}/'" "1" "${DVLBOX_PATH}" || true
exit 1
fi
# Check for Exceptions, Errors or Warnings
if ! run_fail "docker-compose exec --user devilbox -T php curl -sS --fail -L 'http://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}/' | grep -Ei 'fatal|error|warn' >/dev/null" "${RETRIES}" "${DVLBOX_PATH}"; then
run "docker-compose exec --user devilbox -T php curl -sS -L 'http://${VHOST}.${TLD_SUFFIX}:${HOST_PORT_HTTPD}/' | grep -Ei 'fatal|error|warn'" "1" "${DVLBOX_PATH}"
exit 1
fi