diff --git a/README.txt b/README.txt index 81ee78e..f953392 100644 --- a/README.txt +++ b/README.txt @@ -2,9 +2,9 @@ Contributors: kristianwind Tags: woocommerce, discount, email, shipping, coupon Requires at least: 5.8 -Tested up to: 7.1 +Tested up to: 7.1.2 Requires PHP: 7.4 -Stable tag: 1.6.1 +Stable tag: 1.6.2 WC requires at least: 6.0 WC tested up to: 11.1.0 License: GPLv2 or later @@ -96,6 +96,10 @@ The most specific match wins: exact email, then domain, then partial match. == Changelog == += 1.6.2 = +* Declares compatibility with WordPress 7.1.2 and WooCommerce 11.1.2, both tested. No functional change. + + = 1.6.1 = * The status label on the Nolimit dashboard card is now readable. It was white text on a light overlay, which on this plugin's green gave 3.5:1 where 4.5:1 is the accessibility minimum. diff --git a/ci/lib.sh b/ci/lib.sh index a536e02..9c53ad8 100644 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -22,7 +22,7 @@ ci_load_conf() { # leaves the floors empty, every comparison becomes a no-op, and the hollow # checks these were added to fix come back silently — the same shape of bug. local missing= - for var in PLUGIN_SLUG PLUGIN_MAIN TEXT_DOMAIN NEEDS_WOOCOMMERCE MIN_SHIPPED_PHP_FILES MIN_TRANSLATION_CALLS RELEASE_REPO WPMGR_MENU_SHA OLD_PLUGIN_NAME; do + for var in PLUGIN_SLUG PLUGIN_MAIN TEXT_DOMAIN NEEDS_WOOCOMMERCE MIN_SHIPPED_PHP_FILES MIN_TRANSLATION_CALLS RELEASE_REPO WPMGR_MENU_SHA OLD_PLUGIN_NAME MIN_SITE_ASSERTIONS; do [ -n "${!var:-}" ] || missing="$missing $var" done if [ -n "$missing" ]; then diff --git a/ci/plugin.conf b/ci/plugin.conf index e1a95b5..8540a2f 100644 --- a/ci/plugin.conf +++ b/ci/plugin.conf @@ -103,3 +103,9 @@ WPMGR_MENU_SHA=75b04eb4fe9eda0119312075accf2fc77de244e5c6b759d624a8b1d254c0fc99 # can fail when it reappears in text a user reads — a sentence that goes stale # breaks nothing by itself, which is why it survives. OLD_PLUGIN_NAME="WooCommerce Email Discount Manager" + +# The fewest assertions a complete run of tests/smoke.php prints. Verified by +# ci/site-test.sh rather than only inside the file: a smoke file runs in +# function scope, so a `return` partway through skips its own floor and the +# run reports green having tested two thirds of what it claims. +MIN_SITE_ASSERTIONS=60 diff --git a/ci/site-test.sh b/ci/site-test.sh index b67b9e2..5935037 100755 --- a/ci/site-test.sh +++ b/ci/site-test.sh @@ -177,9 +177,39 @@ wp plugin list --name="$PLUGIN_SLUG" --field=status | grep -qx active \ || { echo "The plugin did not stay active after activation." >&2; exit 1; } echo " activated $(wp plugin get "$PLUGIN_SLUG" --field=version)" +# 🔴 The output is captured and the summary checked HERE, by the caller. +# +# A smoke file cannot assert about its own early exit: `wp eval-file` runs it +# in function scope, so a `return` partway through skips everything after it — +# including any floor the file carries at the bottom. Measured: truncating +# tests/smoke.php before the shipping section ran two thirds of the assertions +# and this script reported green, because the file's own floor was one of the +# things never reached. +# +# So the number the file prints is verified against MIN_SITE_ASSERTIONS out +# here, where an early return cannot reach. The floor inside the file stays as +# well; it catches a short run that still gets to the end. for f in ${SITE_TESTS:-}; do ci_step "$f" - wp eval-file "wp-content/plugins/$PLUGIN_SLUG/$f" + out=$(wp eval-file "wp-content/plugins/$PLUGIN_SLUG/$f" 2>&1) || { printf '%s\n' "$out"; exit 1; } + printf '%s\n' "$out" + + case "$f" in + *smoke*) + ran=$(printf '%s' "$out" | sed -n -E 's/^All ([0-9]+) assertions passed.*/\1/p' | tail -1) + if [ -z "$ran" ]; then + echo + ci_fail "$f printed no assertion total. It exited before its summary — which is what a file that returned halfway through looks like, and it cannot report that about itself." + exit 1 + fi + if [ "$ran" -lt "$MIN_SITE_ASSERTIONS" ]; then + echo + ci_fail "$f ran only $ran assertions, expected at least $MIN_SITE_ASSERTIONS. Part of the suite did not run." + exit 1 + fi + echo " $ran assertions, at or above the floor of $MIN_SITE_ASSERTIONS" + ;; + esac done ci_step "PHP notices and deprecations" diff --git a/tests/smoke.php b/tests/smoke.php index 2944faa..4862f2d 100644 --- a/tests/smoke.php +++ b/tests/smoke.php @@ -31,6 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) { * that it can. */ $GLOBALS['wc_edm_failures'] = 0; +$GLOBALS['wc_edm_passes'] = 0; ( static function () { ++$GLOBALS['wc_edm_failures']; } )(); if ( 1 !== $GLOBALS['wc_edm_failures'] ) { echo "The failure counter does not reach the verdict: this file cannot go red.\n"; @@ -47,6 +48,7 @@ $GLOBALS['wc_edm_failures'] = 0; */ function wc_edm_ok( $what, $condition, $detail = '' ) { if ( $condition ) { + ++$GLOBALS['wc_edm_passes']; printf( " ok %s\n", $what ); return; } @@ -799,8 +801,22 @@ if ( $GLOBALS['wc_edm_failures'] > 0 ) { printf( "%d assertion(s) failed on WordPress %s.\n", $GLOBALS['wc_edm_failures'], get_bloginfo( 'version' ) ); exit( 1 ); } +// The number, not just the word. "All assertions passed" is also what a file +// that asserted nothing prints — which is the failure this whole suite exists +// to catch everywhere else, and it was in the summary line the entire time. +// A floor as well, for the same reason every count in ci/ has one: a run that +// died early after a handful of assertions would otherwise read as a pass. +if ( $GLOBALS['wc_edm_passes'] < 60 ) { + printf( + "Only %d assertions ran, which is too few to be a complete run.\n", + $GLOBALS['wc_edm_passes'] + ); + exit( 1 ); +} + printf( - "All assertions passed on WordPress %s with WooCommerce %s.\n", + "All %d assertions passed on WordPress %s with WooCommerce %s.\n", + $GLOBALS['wc_edm_passes'], get_bloginfo( 'version' ), defined( 'WC_VERSION' ) ? WC_VERSION : '?' ); diff --git a/woocommerce-email-discount-manager.php b/woocommerce-email-discount-manager.php index b9e7e78..a867f79 100644 --- a/woocommerce-email-discount-manager.php +++ b/woocommerce-email-discount-manager.php @@ -4,7 +4,7 @@ * Plugin URI: https://gitea.nolimit.dk/kw/woo-discount-manager * Update URI: https://gitea.nolimit.dk/kw/nolimit-discounts-dist * Description: Apply discounts and show/hide shipping methods based on the customer's email address (full address, domain or partial match). - * Version: 1.6.1 + * Version: 1.6.2 * Author: Kristian Wind * Author URI: https://gitea.nolimit.dk/kw * License: GPL-2.0-or-later @@ -12,7 +12,7 @@ * Requires at least: 5.8 * Requires PHP: 7.4 * WC requires at least: 6.0 - * WC tested up to: 11.1.0 + * WC tested up to: 11.1.2 * Requires Plugins: woocommerce */ @@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'WC_EDM_VERSION', '1.6.1' ); +define( 'WC_EDM_VERSION', '1.6.2' ); define( 'WC_EDM_PLUGIN_FILE', __FILE__ ); define( 'WC_EDM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'WC_EDM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );