You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Verify and document the assertion-helper layer now that #21 normalizes status inside the criteria chokepoint.
Because seeOrderStatus() / seeSubscriptionStatus() delegate to seeOrderInDatabase() / seeSubscriptionInDatabase(), and #21 added normalizeStatusInCriteria() to mapCriteria(), the assertion helpers are already normalized end-to-end once #21 lands. So this slice adds no production normalization code — it proves the behavior with acceptance tests and records the contract in docblocks. Normalization lives at a single chokepoint (the criteria layer), not duplicated per method.
This works because normalize() canonicalizes WC statuses to the prefixed form ('active' → 'wc-active'), which is exactly what WooCommerce writes to the database — both legacy wp_posts.post_status and HPOS wc_orders.status store the wc--prefixed value (e.g. WooCommerce's own draft status is DB_STATUS = 'wc-checkout-draft', while the public getter strips the prefix). So both seeOrderStatus($id, 'active') and seeOrderStatus($id, 'wc-active') resolve to WHERE status = 'wc-active' and match the same row. Unknown/third-party statuses pass through verbatim and match as-is.
grab*Status() is not normalized. It delegates to the storage layer (not through mapCriteria()), so it preserves the raw wc--prefixed DB value. This asymmetry is intentional: test authors who use grab*Status() compare manually, as they do today.
Parent
Supersedes closed PRD issue #18.
What to build
Verify and document the assertion-helper layer now that #21 normalizes status inside the criteria chokepoint.
Because
seeOrderStatus()/seeSubscriptionStatus()delegate toseeOrderInDatabase()/seeSubscriptionInDatabase(), and #21 addednormalizeStatusInCriteria()tomapCriteria(), the assertion helpers are already normalized end-to-end once #21 lands. So this slice adds no production normalization code — it proves the behavior with acceptance tests and records the contract in docblocks. Normalization lives at a single chokepoint (the criteria layer), not duplicated per method.This works because
normalize()canonicalizes WC statuses to the prefixed form ('active'→'wc-active'), which is exactly what WooCommerce writes to the database — both legacywp_posts.post_statusand HPOSwc_orders.statusstore thewc--prefixed value (e.g. WooCommerce's own draft status isDB_STATUS = 'wc-checkout-draft', while the public getter strips the prefix). So bothseeOrderStatus($id, 'active')andseeOrderStatus($id, 'wc-active')resolve toWHERE status = 'wc-active'and match the same row. Unknown/third-party statuses pass through verbatim and match as-is.grab*Status()is not normalized. It delegates to the storage layer (not throughmapCriteria()), so it preserves the rawwc--prefixed DB value. This asymmetry is intentional: test authors who usegrab*Status()compare manually, as they do today.Acceptance criteria
OrderMethods::seeOrderStatus/SubscriptionMethods::seeSubscriptionStatus— they continue to delegate tosee*InDatabase()unchanged; normalization is supplied by Status normalization: criteria methods (see*InDatabase, dontSee*InDatabase, grab*IdFromDatabase) #21's criteria chokepoint.OrderCest: write order with'wc-active', thenseeOrderStatus($id, 'active')passes.OrderHPOSCest: same, against HPOS storage.OrderCestorOrderHPOSCest:seeOrderStatus($id, 'wc-active')also passes against the same row (prefixed form still works).SubscriptionCest: write subscription with'wc-active', thenseeSubscriptionStatus($id, 'active')passes.SubscriptionHPOSCest: same, against HPOS storage.grabOrderStatusandgrabSubscriptionStatusare verified untouched (still return raw DB value, e.g.,'wc-active').OrderMethods::seeOrderStatusincludes the WC-prefix note (accepts both forms; non-WC statuses pass through).SubscriptionMethods::seeSubscriptionStatusincludes the same note.grabOrderStatus/grabSubscriptionStatusexplicitly notes the return value is the raw DB value (stillwc--prefixed).Blocked by