Skip to content

Commit

Permalink
Update travis and tests configuration
Browse files Browse the repository at this point in the history
Travis no longer supports PHP 5.4 on the default machine, so this
updates that and tests some newer version as well. A little bit of a
workaround is required to test PHP 7
  • Loading branch information
CodyReichert committed Jul 11, 2019
1 parent bb00c71 commit 8ff92fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
dist: trusty
language: php

php:
- 5.4
- 5.6
- 7.1

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=1
- WP_VERSION=3.8 WP_MULTISITE=0
- WP_VERSION=3.8 WP_MULTISITE=1
- WP_VERSION=4.0 WP_MULTISITE=0
- WP_VERSION=4.0 WP_MULTISITE=1

before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
- chmod +x tests/init.sh && bash tests/init.sh $TRAVIS_PHP_VERSION $WP_VERSION

script: phpunit
19 changes: 19 additions & 0 deletions tests/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

TRAVIS_PHP_VERSION=${1-0}
WP_VERSION=${2-latest}

echo "[init-tests.sh] TRAVIS_PHP_VERSION=$TRAVIS_PHP_VERSION"
echo "[init-tests.sh] WP_VERSION=$WP_VERSION"

# PHP 7 is incompatible with WordPress v4 and lower so we force WordPress 5.0
if [[ $TRAVIS_PHP_VERSION == "7.1"* && $WP_VERSION == 4.0 ]]; then
echo "[notice] PHP 7 is incompatible with WordPress v4 and lower. Forcing WordPress 5.0."
WP_VERSION=5.0
else
:
fi

echo "[init-tests.sh] Using WP_VERSION $WP_VERSION"

bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION

0 comments on commit 8ff92fc

Please sign in to comment.