mirror of
https://github.com/cytopia/devilbox.git
synced 2025-01-18 18:56:25 +00:00
Added CakePHP integration tests for PHP 8+
This commit is contained in:
parent
945566d74b
commit
d11c1304ed
@ -160,6 +160,7 @@ test-smoke-autostart:
|
||||
###
|
||||
test-smoke-framework-cakephp:
|
||||
$(PWD)/tests/framework-cakephp.sh
|
||||
$(PWD)/tests/framework-cakephp-php8.sh
|
||||
|
||||
test-smoke-framework-drupal:
|
||||
$(PWD)/tests/framework-drupal.sh
|
||||
|
95
.tests/tests/framework-cakephp-php8.sh
Executable file
95
.tests/tests/framework-cakephp-php8.sh
Executable file
@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
|
||||
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_PATH="$( cd "$(dirname "$0")" && pwd -P )"
|
||||
DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
|
||||
# shellcheck disable=SC1090
|
||||
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
||||
|
||||
RETRIES=10
|
||||
# see framework-cakephp.sh for PHP <8 tests
|
||||
DISABLED_VERSIONS=("5.2" "5.3" "5.4" "5.5" "5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.2")
|
||||
|
||||
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
|
||||
|
||||
###
|
||||
### What CakePHP Version?
|
||||
###
|
||||
CAKE_PHP_VERSION=4.3
|
||||
|
||||
|
||||
echo
|
||||
echo "# --------------------------------------------------------------------------------------------------"
|
||||
echo "# [Framework] CakePHP ${CAKE_PHP_VERSION}"
|
||||
echo "# --------------------------------------------------------------------------------------------------"
|
||||
echo
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Pre-check
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
|
||||
printf "[SKIP] Skipping all checks for PHP %s\\n" "${PHP_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# ENTRYPOINT
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
###
|
||||
### Get required env values
|
||||
###
|
||||
MYSQL_ROOT_PASSWORD="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "MYSQL_ROOT_PASSWORD" )"
|
||||
TLD_SUFFIX="$( "${SCRIPT_PATH}/../scripts/env-getvar.sh" "TLD_SUFFIX" )"
|
||||
VHOST="my-cakephp"
|
||||
|
||||
# Create vhost dir
|
||||
create_vhost_dir "${VHOST}"
|
||||
|
||||
|
||||
# Setup CakePHP project
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; composer create-project --no-interaction --prefer-dist cakephp/app:~${CAKE_PHP_VERSION} cakephp'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php bash -c 'cd /shared/httpd/${VHOST}; ln -sf cakephp/webroot htdocs'" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php mysql -u root -h mysql --password=\"${MYSQL_ROOT_PASSWORD}\" -e \"DROP DATABASE IF EXISTS my_cake; CREATE DATABASE my_cake;\"" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Configure CakePHP database settings
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'host' =>.*/'host' => 'mysql',/g\" /shared/httpd/${VHOST}/cakephp/config/app_local.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'username' =>.*/'username' => 'root',/g\" /shared/httpd/${VHOST}/cakephp/config/app_local.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'password' =>.*/'password' => '${MYSQL_ROOT_PASSWORD}',/g\" /shared/httpd/${VHOST}/cakephp/config/app_local.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
run "docker-compose exec --user devilbox -T php sed -i\"\" \"s/'database' =>.*/'database' => 'my_cake',/g\" /shared/httpd/${VHOST}/cakephp/config/app_local.php" "${RETRIES}" "${DVLBOX_PATH}"
|
||||
|
||||
# Test CakePHP
|
||||
ERROR=0
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'mbstring'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'openssl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'intl'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'tmp directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'logs directory'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
if ! run "docker-compose exec --user devilbox -T php curl -sS --fail 'http://${VHOST}.${TLD_SUFFIX}' | tac | tac | grep '\"bullet success\"' | grep 'connect to the database'" "${RETRIES}" "${DVLBOX_PATH}"; then
|
||||
ERROR=1
|
||||
fi
|
||||
|
||||
if [ "${ERROR}" = "1" ]; then
|
||||
run "docker-compose exec --user devilbox -T php curl 'http://${VHOST}.${TLD_SUFFIX}' || true" "1" "${DVLBOX_PATH}"
|
||||
exit 1
|
||||
fi
|
@ -13,6 +13,7 @@ DVLBOX_PATH="$( cd "${SCRIPT_PATH}/../.." && pwd -P )"
|
||||
. "${SCRIPT_PATH}/../scripts/.lib.sh"
|
||||
|
||||
RETRIES=10
|
||||
# see framework-cakephp-php8.sh for PHP 8+ tests
|
||||
DISABLED_VERSIONS=("5.2" "5.3" "5.4" "5.5" "8.0" "8.1" "8.2")
|
||||
|
||||
PHP_VERSION="$( get_php_version "${DVLBOX_PATH}" )"
|
||||
|
@ -8,6 +8,9 @@ Make sure to have a look at [UPDATING.md](https://github.com/cytopia/devilbox/bl
|
||||
|
||||
## Release v1.11.0 (2022-04-01)
|
||||
|
||||
#### Added
|
||||
- Added CakePHP integration tests for PHP 8+
|
||||
|
||||
#### Changed
|
||||
- Changed default PostgreSQL server from `12.4` to `14-alpine`
|
||||
- Changed default Redis server from `6.0` to `6.2-alpine`
|
||||
|
Loading…
Reference in New Issue
Block a user