Merge pull request #46 from kristianwind/compat-values-must-agree-across-files
1.6.3: the tested-WooCommerce version now agrees with itself
This commit is contained in:
+5
-2
@@ -4,9 +4,9 @@ Tags: woocommerce, discount, email, shipping, coupon
|
||||
Requires at least: 5.8
|
||||
Tested up to: 7.1.2
|
||||
Requires PHP: 7.4
|
||||
Stable tag: 1.6.2
|
||||
Stable tag: 1.6.3
|
||||
WC requires at least: 6.0
|
||||
WC tested up to: 11.1.0
|
||||
WC tested up to: 11.1.2
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -96,6 +96,9 @@ The most specific match wins: exact email, then domain, then partial match.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.6.3 =
|
||||
* The WooCommerce version this plugin declares as tested is now the same in both places it is written. The readme still said 11.1.0 while the plugin itself said 11.1.2.
|
||||
|
||||
= 1.6.2 =
|
||||
* Declares compatibility with WordPress 7.1.2 and WooCommerce 11.1.2, both tested. No functional change.
|
||||
|
||||
|
||||
@@ -329,6 +329,47 @@ else
|
||||
ok "no fixture executed: the clone still has no local identity"
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------ compat values in two files
|
||||
# 🔴 The two currency checks read each value from the file that value belongs
|
||||
# in — correct, and therefore blind to a SECOND copy in the other file. The
|
||||
# plugin header said WC 11.1.2 and README.txt said 11.1.0 for four releases
|
||||
# with that step printing green. Each reading was right; the pair was never
|
||||
# compared. So these rows are about our own two copies agreeing, which is a
|
||||
# fact about this tree and fatal, not about being up to date, which is advisory.
|
||||
echo
|
||||
echo "→ a compatibility value in two files must agree"
|
||||
cd "$work/repo"
|
||||
cp README.txt "$work/README.orig"
|
||||
compat_row() { # $1 = field, $2 = value to plant in the readme
|
||||
cp "$work/README.orig" README.txt
|
||||
sed -i "s/^$1: .*/$1: $2/" README.txt
|
||||
if [ "$(grep -c "^$1: $2\$" README.txt)" -lt 1 ]; then
|
||||
bad "could not stage the compat fixture for '$1'"
|
||||
return
|
||||
fi
|
||||
compat_out=$(./ci/static.sh 2>&1 || true)
|
||||
if printf '%s' "$compat_out" | grep -q "'$1' is .* in the plugin header and"; then
|
||||
ok "flagged a drifted '$1' ($2 in the readme)"
|
||||
else
|
||||
bad "NOT FLAGGED: '$1' drifted to $2 in the readme and nothing compared the two copies"
|
||||
fi
|
||||
}
|
||||
compat_row 'WC tested up to' '11.0.0'
|
||||
compat_row 'Requires PHP' '8.0'
|
||||
compat_row 'Requires at least' '5.0'
|
||||
cp "$work/README.orig" README.txt
|
||||
|
||||
# The pass must say how many pairs it compared. A tree where the readme carries
|
||||
# none of these fields has nothing to disagree and prints the same silence as
|
||||
# one where every pair matches.
|
||||
compat_clean=$(./ci/static.sh 2>&1 || true)
|
||||
pairs=$(printf '%s' "$compat_clean" | grep -c "^ both files say ")
|
||||
if [ "$pairs" -ge 3 ]; then
|
||||
ok "$pairs value pairs compared across the two files"
|
||||
else
|
||||
bad "only $pairs pairs compared — the agreement check has almost nothing to look at"
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------- plugin.conf
|
||||
echo
|
||||
echo "→ the floors must be required, not defaulted"
|
||||
|
||||
@@ -476,6 +476,31 @@ behind() { # claimed current -> true when claimed is the older of the two
|
||||
# reads that one from the plugin header and nowhere else.
|
||||
|
||||
|
||||
# 🔴 A value in two files drifts, and reading each one from its authoritative
|
||||
# file is a correct answer to a different question. The two checks below ask
|
||||
# "is this value current", one per value, each in the file that value belongs
|
||||
# in — so a SECOND copy of the same value in the other file is never compared
|
||||
# with anything. Measured 2026-09-28: the plugin header said WC 11.1.2 and
|
||||
# README.txt said 11.1.0, four releases after the bump, with this step green
|
||||
# and printing "plugin header says 11.1.2, current release is 11.1.2" — true,
|
||||
# complete, and about the copy that was already right.
|
||||
#
|
||||
# So: any field carried by BOTH files must agree. Not "is it current" (that is
|
||||
# advisory below, and rightly), but "do our own two copies say the same thing",
|
||||
# which is a fact about this tree and therefore fatal.
|
||||
for field in 'Tested up to' 'WC tested up to' 'Requires at least' 'Requires PHP'; do
|
||||
h=$(ci_plugin_header "$field")
|
||||
r=
|
||||
[ -n "$readme" ] && r=$(sed -n -E "s/^$field:[[:space:]]*([^[:space:]]+).*/\1/p" "$readme" | head -1)
|
||||
if [ -n "$h" ] && [ -n "$r" ]; then
|
||||
if [ "$h" = "$r" ]; then
|
||||
echo " both files say '$field: $h'"
|
||||
else
|
||||
note_fail "'$field' is '$h' in the plugin header and '$r' in $readme. One of them is stale and nothing else compares them."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
tested_wp=
|
||||
[ -n "$readme" ] && tested_wp=$(sed -n -E 's/^Tested up to:[[:space:]]*([^[:space:]]+).*/\1/p' "$readme" | head -1)
|
||||
echo " WordPress: ${readme:-readme} says ${tested_wp:-<missing>}, current release is ${current_wp:-<unknown>}"
|
||||
|
||||
@@ -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.2
|
||||
* Version: 1.6.3
|
||||
* Author: Kristian Wind
|
||||
* Author URI: https://gitea.nolimit.dk/kw
|
||||
* License: GPL-2.0-or-later
|
||||
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'WC_EDM_VERSION', '1.6.2' );
|
||||
define( 'WC_EDM_VERSION', '1.6.3' );
|
||||
define( 'WC_EDM_PLUGIN_FILE', __FILE__ );
|
||||
define( 'WC_EDM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'WC_EDM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
Reference in New Issue
Block a user