Skip to content

Commit

Permalink
Set environment variable CIVICRM_SMARTY_AUTOLOAD_PATH in Docker con…
Browse files Browse the repository at this point in the history
…tainer to avoid a PHP error
  • Loading branch information
Dominic Tubach committed Sep 4, 2024
1 parent 34deb2b commit 41be0e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions tests/docker-phpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ if [ ! -e tools/phpunit/vendor/bin ]; then
"$SCRIPT_DIR/docker-prepare.sh"
fi

# CIVICRM_SMARTY_AUTOLOAD_PATH is not set in the container's civicrm.settings.php so we have to do it here.
# Otherwise this results in this error:
# Fatal error: Cannot declare class Smarty, because the name is already in use in /var/www/html/sites/all/modules/civicrm/packages/smarty5/Smarty.php on line 4
#
smarty=$(printf '%s\n' /var/www/html/sites/all/modules/civicrm/packages/smarty* | sort -r | head -n1)
if [ -e "$smarty/Smarty.php" ]; then
export CIVICRM_SMARTY_AUTOLOAD_PATH="$smarty/Smarty.php"
elif [ -e "$smarty/vendor/autoload.php" ]; then
export CIVICRM_SMARTY_AUTOLOAD_PATH="$smarty/vendor/autoload.php"
fi

export XDEBUG_MODE=coverage
# TODO: Remove when not needed, anymore.
# In Docker container with CiviCRM 5.5? all deprecations are reported as direct
Expand Down
4 changes: 2 additions & 2 deletions tests/docker-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -eu -o pipefail

XCM_VERSION=1.12.0
IDENTITYTRACKER_VERSION=1.4-alpha4
XCM_VERSION=1.13.1
IDENTITYTRACKER_VERSION=1.4.0

EXT_DIR=$(dirname "$(dirname "$(realpath "$0")")")
EXT_NAME=$(basename "$EXT_DIR")
Expand Down

0 comments on commit 41be0e7

Please sign in to comment.