# and, once you have finished all testing related work:
./tests/ci/vm.sh cleanup
-By default tests are run using php 7.2 in a Container based on Ubuntu 18 Bionic.
+By default, tests are run using php 7.4 in a Container based on Ubuntu 20 Focal.
You can change the version of PHP and Ubuntu in use by setting the environment variables PHP_VERSION and UBUNTU_VERSION
before building the Container.
"php": "^5.3.0 || ^7.0 || ^8.0",
"ext-xml": "*"
},
- "_comment::tests": "The dev packages below require a minimum of php 5.6, even though we support php 5.3. Can we manage to do better?",
+ "_comment::tests": "The dev packages below require a minimum of php 5.4, even though we support php 5.3. Can we manage to do better?",
"require-dev": {
- "phpunit/phpunit": "^5.0 || ^8.5.14",
+ "phpunit/phpunit": "^4.8 || ^5.0 || ^8.5.14",
"phpunit/phpunit-selenium": "*",
"yoast/phpunit-polyfills": "*",
"ext-curl": "*",
class_alias( 'PHPUnit_Runner_BaseTestRunner', 'PHPUnit\Runner\BaseTestRunner' );
}
-if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
+if (class_exists('PHPUnit_Version') === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
include_once __DIR__ . '/PolyfillTestCase7.php';
} else {
include_once __DIR__ . '/PolyfillTestCase8.php';
-ARG UBUNTU_VERSION=bionic
+ARG UBUNTU_VERSION=focal
FROM ubuntu:${UBUNTU_VERSION}
if [ $(stat -c '%u' "${CONTAINER_USER_HOME}") != "${CONTAINER_USER_UID}" -o $(stat -c '%g' "${CONTAINER_USER_HOME}") != "${CONTAINER_USER_GID}" ]; then
chown "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "${CONTAINER_USER_HOME}"
chown -R "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "${CONTAINER_USER_HOME}"/.*
+ if [ -d /usr/local/php ]; then
+ chown -R "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" /usr/local/php
+ fi
fi
# @todo do the same chmod for ${TESTS_ROOT_DIR}, if it's not within CONTAINER_USER_HOME
a2enmod rewrite proxy_fcgi setenvif ssl http2
# in case mod-php was enabled (this is the case at least on GHA's ubuntu with php 5.x and shivammathur/setup-php)
-# @todo silence errors in a smarter way
-rm /etc/apache2/mods-enabled/php* || true
+if [ -n "$(ls /etc/apache2/mods-enabled/php* 2>/dev/null)" ]; then
+ rm /etc/apache2/mods-enabled/php*
+fi
# configure apache virtual hosts
echo "always_populate_raw_post_data = -1" >> "${1}"
# we disable xdebug for speed for both cli and web mode
- phpdismod xdebug
+ if which phpdesmod >/dev/null 2>/dev/null; then
+ phpdismod xdebug
+ elif [ -f /usr/local/php/$PHP_VERSION/etc/conf.d/20-xdebug.ini ]; then
+ mv /usr/local/php/$PHP_VERSION/etc/conf.d/20-xdebug.ini /usr/local/php/$PHP_VERSION/etc/conf.d/20-xdebug.ini.bak
+ fi
}
# install php
fi
done
- DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
- LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
- apt-get update
-
- DEBIAN_FRONTEND=noninteractive apt-get install -y \
- php${PHP_VERSION} \
- php${PHP_VERSION}-cli \
- php${PHP_VERSION}-dom \
- php${PHP_VERSION}-curl \
- php${PHP_VERSION}-fpm \
- php${PHP_VERSION}-mbstring \
- php${PHP_VERSION}-xdebug
-
- update-alternatives --set php /usr/bin/php${PHP_VERSION}
+ if [ "${PHP_VERSION}" = 5.3 -o "${PHP_VERSION}" = 5.4 -o "${PHP_VERSION}" = 5.5 ]; then
+ # NB: this set of packages has only been tested on Focal so far
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ curl \
+ enchant \
+ imagemagick \
+ libc-client2007e \
+ libcurl3-gnutls \
+ libmcrypt4 \
+ libodbc1 \
+ libpq5 \
+ libqdbm14 \
+ libtinfo5 \
+ libxpm4 \
+ libxslt1.1 \
+ mysql-common \
+ zstd
+ if [ ! -d /usr/include/php ]; then mkdir -p /usr/include/php; fi
+
+ set +e
+ curl -sSL https://github.com/shivammathur/php5-ubuntu/releases/latest/download/install.sh | bash -s "${PHP_VERSION}"
+ # we have to do this as the init script we get for starting/stopping php-fpm seems to be faulty...
+ pkill php-fpm
+ else
+ DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
+ LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
+ apt-get update
+
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ php${PHP_VERSION} \
+ php${PHP_VERSION}-cli \
+ php${PHP_VERSION}-dom \
+ php${PHP_VERSION}-curl \
+ php${PHP_VERSION}-fpm \
+ php${PHP_VERSION}-mbstring \
+ php${PHP_VERSION}-xdebug
+
+ update-alternatives --set php /usr/bin/php${PHP_VERSION}
+ fi
fi
PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)
-configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
+if [ -d /etc/php/${PHPVER}/fpm ]; then
+ configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
+elif [ -f /usr/local/php/${PHPVER}/etc/php.ini ]; then
+ configure_php_ini /usr/local/php/${PHPVER}/etc/php.ini
+fi
# use a nice name for the php-fpm service, so that it does not depend on php version running. Try to make that work
# both for docker and VMs
# Valid values: 'default', 5.6, 7.0 .. 7.4, 8.0 .. 8.1
export PHP_VERSION=${PHP_VERSION:-default}
# Valid values: precise (12), trusty (14), xenial (16), bionic (18), focal (20), jammy (22)
-export UBUNTU_VERSION=${UBUNTU_VERSION:-bionic}
+export UBUNTU_VERSION=${UBUNTU_VERSION:-focal}
CONTAINER_USER=docker
CONTAINER_BUILD_DIR="/home/${CONTAINER_USER}/build"
Environment variables: to be set before the 'build' action
PHP_VERSION default value: 'default', ie. the stock php version from the Ubuntu version in use. Other possible values: 5.6, 7.0 .. 8.1
- UBUNTU_VERSION default value: bionic. Other possible values: xenial, focal, jammy
+ UBUNTU_VERSION default value: focal. Other possible values: xenial, bionic, jammy
"
}