1.6.2: WP 7.1.2 and WC 11.1.2 declared, and the caller counts the assertions

Kristian asked the family to check WordPress 7.1.2. Run pinned rather than
against "latest", because latest drifts and then nobody knows which version a
green belonged to:

  PHP 7.4   69 assertions, 0 failures   "none from this plugin"
  PHP 8.3   69 assertions, 0 failures   "none from this plugin"
  PHP 8.4   69 assertions, 0 failures   "none from this plugin"

The container reported WordPress 7.1.2 and WooCommerce 11.1.2 on all three,
read out of the run rather than from the variable it was given. So there is no
problem with 7.1.2 here.

The findings were in the reporting, not the code.

The headers were stale: "Tested up to: 7.1" and "WC tested up to: 11.1.0"
against current 7.1.2 and 11.1.2. The WooCommerce one is the visible half — a
shop on 11.1.2 sees an untested warning on the WooCommerce status page, and on
this plugin that banner sits in front of somebody deciding whether to update a
discount engine.

And the suite said "All assertions passed" without a number, which is the exact
failure every other check here was fixed for. It now prints the count.

🔴 Then the floor for that count found a bigger hole than it was written for.
Putting it at the end of the smoke file does nothing: wp eval-file runs the
file in function scope, so a `return` partway through skips everything after
it, including the floor. Measured — truncating tests/smoke.php before the
shipping section ran two thirds of the assertions and ci/site-test.sh reported
GREEN.

A file cannot assert about its own early exit. ci/site-test.sh now captures the
output and checks the total against MIN_SITE_ASSERTIONS from outside, where an
early return cannot reach, and fails when the summary line is missing
altogether. The in-file floor stays for a short run that does reach the end.

Proven with the same fixture that exposed it: the truncated suite now exits 1
saying it printed no assertion total.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kristianwind
2026-09-25 08:51:46 +02:00
co-authored by Claude Opus 5
parent 9931c74b45
commit 2b289c6763
6 changed files with 64 additions and 8 deletions
+6 -2
View File
@@ -2,9 +2,9 @@
Contributors: kristianwind Contributors: kristianwind
Tags: woocommerce, discount, email, shipping, coupon Tags: woocommerce, discount, email, shipping, coupon
Requires at least: 5.8 Requires at least: 5.8
Tested up to: 7.1 Tested up to: 7.1.2
Requires PHP: 7.4 Requires PHP: 7.4
Stable tag: 1.6.1 Stable tag: 1.6.2
WC requires at least: 6.0 WC requires at least: 6.0
WC tested up to: 11.1.0 WC tested up to: 11.1.0
License: GPLv2 or later License: GPLv2 or later
@@ -96,6 +96,10 @@ The most specific match wins: exact email, then domain, then partial match.
== Changelog == == Changelog ==
= 1.6.2 =
* Declares compatibility with WordPress 7.1.2 and WooCommerce 11.1.2, both tested. No functional change.
= 1.6.1 = = 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. * 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.
+1 -1
View File
@@ -22,7 +22,7 @@ ci_load_conf() {
# leaves the floors empty, every comparison becomes a no-op, and the hollow # 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. # checks these were added to fix come back silently — the same shape of bug.
local missing= 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" [ -n "${!var:-}" ] || missing="$missing $var"
done done
if [ -n "$missing" ]; then if [ -n "$missing" ]; then
+6
View File
@@ -103,3 +103,9 @@ WPMGR_MENU_SHA=75b04eb4fe9eda0119312075accf2fc77de244e5c6b759d624a8b1d254c0fc99
# can fail when it reappears in text a user reads — a sentence that goes stale # can fail when it reappears in text a user reads — a sentence that goes stale
# breaks nothing by itself, which is why it survives. # breaks nothing by itself, which is why it survives.
OLD_PLUGIN_NAME="WooCommerce Email Discount Manager" 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
+31 -1
View File
@@ -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 "The plugin did not stay active after activation." >&2; exit 1; }
echo " activated $(wp plugin get "$PLUGIN_SLUG" --field=version)" 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 for f in ${SITE_TESTS:-}; do
ci_step "$f" 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 done
ci_step "PHP notices and deprecations" ci_step "PHP notices and deprecations"
+17 -1
View File
@@ -31,6 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* that it can. * that it can.
*/ */
$GLOBALS['wc_edm_failures'] = 0; $GLOBALS['wc_edm_failures'] = 0;
$GLOBALS['wc_edm_passes'] = 0;
( static function () { ++$GLOBALS['wc_edm_failures']; } )(); ( static function () { ++$GLOBALS['wc_edm_failures']; } )();
if ( 1 !== $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"; 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 = '' ) { function wc_edm_ok( $what, $condition, $detail = '' ) {
if ( $condition ) { if ( $condition ) {
++$GLOBALS['wc_edm_passes'];
printf( " ok %s\n", $what ); printf( " ok %s\n", $what );
return; 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' ) ); printf( "%d assertion(s) failed on WordPress %s.\n", $GLOBALS['wc_edm_failures'], get_bloginfo( 'version' ) );
exit( 1 ); 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( 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' ), get_bloginfo( 'version' ),
defined( 'WC_VERSION' ) ? WC_VERSION : '?' defined( 'WC_VERSION' ) ? WC_VERSION : '?'
); );
+3 -3
View File
@@ -4,7 +4,7 @@
* Plugin URI: https://gitea.nolimit.dk/kw/woo-discount-manager * Plugin URI: https://gitea.nolimit.dk/kw/woo-discount-manager
* Update URI: https://gitea.nolimit.dk/kw/nolimit-discounts-dist * 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). * 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: Kristian Wind
* Author URI: https://gitea.nolimit.dk/kw * Author URI: https://gitea.nolimit.dk/kw
* License: GPL-2.0-or-later * License: GPL-2.0-or-later
@@ -12,7 +12,7 @@
* Requires at least: 5.8 * Requires at least: 5.8
* Requires PHP: 7.4 * Requires PHP: 7.4
* WC requires at least: 6.0 * WC requires at least: 6.0
* WC tested up to: 11.1.0 * WC tested up to: 11.1.2
* Requires Plugins: woocommerce * Requires Plugins: woocommerce
*/ */
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; 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_FILE', __FILE__ );
define( 'WC_EDM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'WC_EDM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'WC_EDM_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'WC_EDM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );