ldc-web-images-docker/PHP8.5/DEV/tests.sh

71 lines
2.7 KiB
Bash

#!/usr/bin/env bash
# Import shared utilities.
source "$(pwd)/PHP8.5/utils.sh"
start_tests
# Import shared tests.
source "$(pwd)/PHP8.5/common.sh"
section "PHP extensions"
run "gd" "php -m | grep -qx 'gd'"
run "exif" "php -m | grep -qx 'exif'"
run "gettext" "php -m | grep -qx 'gettext'"
run "intl" "php -m | grep -qx 'intl'"
run "mysqli" "php -m | grep -qx 'mysqli'"
run "pdo_mysql" "php -m | grep -qx 'pdo_mysql'"
run "xsl" "php -m | grep -qx 'xsl'"
run "zip" "php -m | grep -qx 'zip'"
run "bcmath" "php -m | grep -qx 'bcmath'"
run "gmp" "php -m | grep -qx 'gmp'"
run "mbstring" "php -m | grep -qx 'mbstring'"
run "imagick" "php -m | grep -qx 'imagick'"
run "redis" "php -m | grep -qx 'redis'"
run "xdebug" "php -m | grep -qx 'xdebug'"
run "pcov" "php -m | grep -qx 'pcov'"
section "Compiled extensions"
run "gd: imagecreate" "php -r '\$i = imagecreate(10,10); echo \$i ? \"ok\" : \"fail\";'"
run "imagick: instanciation" "php -r 'new Imagick(); echo \"ok\";'"
run "xdebug: mode configurable" "php -d xdebug.mode=off -m | grep -q xdebug"
run "pcov: driver disponible" "php -m | grep -q pcov"
section "Apache & PHP-FPM"
run "httpd binaire present" "which httpd"
run "php-fpm binaire present" "which php-fpm"
run "httpd -v" "httpd -v"
run "php-fpm -v" "php-fpm -v"
run "module proxy_fcgi enabled" "grep -r 'proxy_fcgi' /etc/apache2/"
run "module rewrite enabled" "grep -r 'rewrite_module' /etc/apache2/"
run "module remoteip enabled" "grep -r 'remoteip_module' /etc/apache2/"
run "module headers active" "grep -r 'headers_module' /etc/apache2/"
run "vhost.conf present" "test -f /etc/apache2/conf.d/vhost.conf"
run "php-fpm.conf present" "test -f /usr/local/etc/php-fpm.d/www.conf"
run "xdebug.ini present" "test -f /usr/local/etc/php/conf.d/xdebug.ini"
section "QA tools"
run_output "composer version" "composer --version 2>/dev/null | awk '{print \$1,\$2,\$3}'"
run_output "bun version" "bun --version"
run_output "node version" "node --version"
run_output "npm version" "npm --version"
section "Utilities"
run "git disponible" "git --version"
run "curl disponible" "curl --version"
run "unzip disponible" "unzip -v"
section "Shell"
run "zsh disponible" "which zsh"
run "oh-my-zsh installed" "test -d /root/.oh-my-zsh"
run "zsh-autosuggestions" "test -d /root/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
run "SHELL=zsh" "[ \"\$SHELL\" = '/bin/zsh' ]"
section "Paths"
run "WORKDIR = /app/srcs" "[ \"\$(pwd)\" = '/app/srcs' ]"
run "docker-entrypoint present" "test -x /usr/local/bin/docker-entrypoint.sh"
section "User"
run "default user = www-data" "test \"\$(id -un)\" = 'www-data'" www-data
end_tests