Skip to content

Commit

Permalink
[CMSP-519] Tested up to WordPress 6.3 (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwtyler authored Aug 11, 2023
1 parent 9d2a8e2 commit a4682d5
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 46 deletions.
38 changes: 12 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: 2.1
workflows:
main:
jobs:
- lint
- test-behat
- test-phpunit-redis-disabled-74
- test-phpunit-redis-enabled-74
Expand Down Expand Up @@ -58,26 +57,8 @@ commands:
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 nightly true
composer phpunit
jobs:
lint:
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.0
steps:
- checkout
- restore_cache:
keys:
- test-lint-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist
- save_cache:
key: test-lint-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- run:
name: "Run PHP Lint"
command: |
composer phpcs
test-behat:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
parallelism: 1
docker:
Expand Down Expand Up @@ -117,16 +98,18 @@ jobs:
exit 0
fi
terminus auth:login --machine-token=$TERMINUS_TOKEN
- run: ./bin/validate-fixture-version.sh
- run: ./bin/behat-prepare.sh
- run: ./bin/behat-test.sh --strict
- run:
command: ./bin/behat-cleanup.sh
when: always
test-phpunit-redis-disabled-74:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: circleci/php:7.4-node-browsers
- image: circleci/mariadb:10.3
- image: cimg/mariadb:10.3
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
Expand All @@ -145,11 +128,12 @@ jobs:
- install-mariadb-10-5
- run-phpunit-tests
test-phpunit-redis-enabled-74:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: circleci/php:7.4-node-browsers
- image: circleci/mariadb:10.3
- image: circleci/redis:latest
- image: cimg/mariadb:10.3
- image: cimg/redis:6.2
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
Expand All @@ -169,10 +153,11 @@ jobs:
- install-redis-extras
- run-phpunit-tests
test-phpunit-redis-disabled-82:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: cimg/php:8.2.0
- image: circleci/mariadb:10.3
- image: cimg/mariadb:10.3
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
Expand All @@ -190,11 +175,12 @@ jobs:
- install-mariadb-10-6
- run-phpunit-tests
test-phpunit-redis-enabled-82:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: cimg/php:8.2.0
- image: circleci/mariadb:10.3
- image: circleci/redis:latest
- image: cimg/mariadb:10.3
- image: cimg/redis:6.2
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/validate-readme-spacing@v1
lint:
name: PHPCS Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-lint-dependencies-{{ checksum "composer.json" }}
restore-keys: test-lint-dependencies-{{ checksum "composer.json" }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
- name: Install dependencies
run: composer install -n --prefer-dist
- name: Run PHP Lint
run: composer phpcs
wporg-validation:
name: WP.org Validator
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Contributors:** [getpantheon](https://profiles.wordpress.org/getpantheon), [danielbachhuber](https://profiles.wordpress.org/danielbachhuber), [mboynes](https://profiles.wordpress.org/mboynes), [Outlandish Josh](https://profiles.wordpress.org/outlandish-josh) [jspellman](https://profiles.wordpress.org/jspellman/) [jazzs3quence](https://profiles.wordpress.org/jazzs3quence/)
**Tags:** cache, plugin, redis
**Requires at least:** 3.0.1
**Tested up to:** 6.2
**Tested up to:** 6.3
**Stable tag:** 1.4.4-dev
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
10 changes: 2 additions & 8 deletions bin/behat-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ rsync -av --exclude='vendor/' --exclude='node_modules/' --exclude='tests/' ./* $
rm -rf $PREPARE_DIR/wp-content/plugins/wp-redis/.git
cp object-cache.php $PREPARE_DIR/wp-content/object-cache.php

# Download the latest Classic Editor release from WordPress.org
wget -O $PREPARE_DIR/classic-editor.zip https://downloads.wordpress.org/plugin/classic-editor.zip
unzip $PREPARE_DIR/classic-editor.zip -d $PREPARE_DIR
mv $PREPARE_DIR/classic-editor $PREPARE_DIR/wp-content/plugins/
rm $PREPARE_DIR/classic-editor.zip

###
# Add the debugging plugin to the environment
###
Expand Down Expand Up @@ -90,7 +84,7 @@ echo "Installing WordPress..."
} &> /dev/null

echo "Flush cache and setup environment..."
terminus wp $SITE_ENV -- plugin activate wp-redis classic-editor
terminus wp $SITE_ENV -- plugin activate wp-redis
terminus wp $SITE_ENV -- cache flush
terminus wp $SITE_ENV -- theme activate twentyseventeen
terminus wp $SITE_ENV -- theme activate twentytwentythree
terminus wp $SITE_ENV -- rewrite structure '/%year%/%monthnum%/%day%/%postname%/'
42 changes: 42 additions & 0 deletions bin/validate-fixture-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

main(){
export TERMINUS_HIDE_GIT_MODE_WARNING=1
local DIRNAME=$(dirname "$0")

if [ -z "${TERMINUS_SITE}" ]; then
echo "TERMINUS_SITE environment variable must be set"
exit 1
fi

if ! terminus whoami > /dev/null; then
if [ -z "${TERMINUS_TOKEN}" ]; then
echo "TERMINUS_TOKEN environment variable must be set or terminus already logged in."
exit 1
fi
terminus auth:login --machine-token="${TERMINUS_TOKEN}"
fi
# Use find to locate the file with a case-insensitive search
README_FILE_PATH=$(find ${DIRNAME}/.. -iname "readme.txt" -print -quit)
if [[ -z "$README_FILE_PATH" ]]; then
echo "readme.txt not found."
exit 1
fi

local TESTED_UP_TO
TESTED_UP_TO=$(grep -i "Tested up to:" "${README_FILE_PATH}" | tr -d '\r\n' | awk -F ': ' '{ print $2 }')
echo "Tested Up To: ${TESTED_UP_TO}"
local FIXTURE_VERSION
FIXTURE_VERSION=$(terminus wp "${TERMINUS_SITE}.dev" -- core version)
echo "Fixture Version: ${FIXTURE_VERSION}"

if ! php -r "exit(version_compare('${TESTED_UP_TO}', '${FIXTURE_VERSION}'));"; then
echo "${FIXTURE_VERSION} is less than ${TESTED_UP_TO}"
echo "Please update ${TERMINUS_SITE} to at least WordPress ${TESTED_UP_TO}"
exit 1
fi
}

main
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: getpantheon, danielbachhuber, mboynes, Outlandish Josh, jspellman, jazzs3quence
Tags: cache, plugin, redis
Requires at least: 3.0.1
Tested up to: 6.2
Tested up to: 6.3
Stable tag: 1.4.4-dev
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
12 changes: 2 additions & 10 deletions tests/behat/load-wp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@ Feature: Load WordPress
Given I am on the homepage
Then I should see "Hello World"

Scenario: Verify that a user can publish a blog post
Given I log in as an admin

When I go to "/wp-admin/post-new.php"
And I fill in "post_title" with "Awesome Post"
And I press "publish"
Then I should see "Post published."

Scenario: Verify that a user can update the site's title
When I go to the homepage
Then print current URL
And the "#masthead" element should not contain "Pantheon WordPress Site"
And the ".wp-block-site-title" element should not contain "Pantheon WordPress Site"

Given I log in as an admin

Expand All @@ -27,4 +19,4 @@ Feature: Load WordPress
And I should see "Settings saved."

When I go to the homepage
Then the "#masthead" element should contain "Pantheon WordPress Site"
Then the ".wp-block-site-title" element should contain "Pantheon WordPress Site"

0 comments on commit a4682d5

Please sign in to comment.