-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Load fulfillments classes in init action hook #59869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Testing GuidelinesApart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
📝 Walkthrough""" WalkthroughThis change refactors the WooCommerce fulfillments subsystem to defer initialization and dependency resolution. Constructors in key fulfillment classes are replaced with explicit Changes
Sequence Diagram(s)sequenceDiagram
participant WP as WordPress
participant FC as FulfillmentsController
participant Container as DI Container
participant Features as FeaturesController
participant DBUtil as DatabaseUtil
WP->>FC: call register()
FC->>WP: add_action('init', initialize_fulfillments)
WP->>FC: on 'init', call initialize_fulfillments()
FC->>Container: get(FeaturesController)
FC->>Features: is_enabled('fulfillments')?
alt Feature enabled
FC->>Container: get(DatabaseUtil)
FC->>DBUtil: maybe_create_db_tables()
FC->>FC: register fulfillment classes
else Feature not enabled
FC-->>WP: return (no-op)
end
Estimated code review effort3 (~35–50 minutes) Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (5)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php (1)
410-413
: KeepReflectionClass
usage consistent across the test fileOnly this invocation was updated to
\ReflectionClass
, while four other invocations below still use the un-qualifiedReflectionClass
.
Because the file has no namespace, both forms work, but mixing styles is noisy and makes future search/replace harder. Pick one convention and apply it everywhere (import once or fully-qualify everywhere).Minimal fix (imports once, restores short name here):
@@ declare( strict_types=1 ); +use ReflectionClass; @@ - $reflection = new \ReflectionClass( 'WC_Tax' ); + $reflection = new ReflectionClass( 'WC_Tax' );Or, if you prefer full qualification, convert the remaining four occurrences instead.
Either way, align on a single style.
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
plugins/woocommerce/changelog/59869-fix-fulfillments-load-text-domain-warning
(1 hunks)plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php
(3 hunks)plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php
(1 hunks)plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php
(1 hunks)plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php
(1 hunks)plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
(1 hunks)plugins/woocommerce/tests/php/includes/class-wc-tax-test.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php
(23 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php
(2 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php
(2 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php
(16 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php
(10 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php
(1 hunks)plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php
(1 hunks)
📓 Path-based instructions (2)
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/code-quality.mdc)
**/*.{php,js,jsx,ts,tsx}
: Guard against unexpected inputs
Sanitize and validate any potentially dangerous inputs
Ensure code is backwards compatible
Write code that is readable and intuitive
Ensure code has unit or E2E tests where applicable
Files:
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit Configuration File
**/*.{php,js,ts,jsx,tsx}
: Don't trust that extension developers will follow the best practices, make sure the code:
- Guards against unexpected inputs.
- Sanitizes and validates any potentially dangerous inputs.
- Is backwards compatible.
- Is readable and intuitive.
- Has unit or E2E tests where applicable.
Files:
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php
🧠 Learnings (19)
📓 Common learnings
Learnt from: tpaksu
PR: woocommerce/woocommerce#59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Learnt from: gigitux
PR: woocommerce/woocommerce#58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
Learnt from: ralucaStan
PR: woocommerce/woocommerce#58782
File: plugins/woocommerce/client/blocks/assets/js/base/utils/render-frontend.tsx:0-0
Timestamp: 2025-06-16T16:12:12.148Z
Learning: For WooCommerce checkout blocks, lazy loading was removed in favor of direct imports to prevent sequential "popping" effects during component loading. This approach prioritizes user experience over code splitting, with minimal bundle size impact and improved performance (1.7s to 1.1s speed score improvement). The checkout flow benefits from having all components load together rather than incrementally.
plugins/woocommerce/changelog/59869-fix-fulfillments-load-text-domain-warning (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: jorgeatorres
PR: #59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in plugins/woocommerce/changelog/
directory and are processed during releases, not at the repository root level.
Learnt from: opr
PR: woocommerce/woocommerce#0
File: :0-0
Timestamp: 2025-06-20T17:38:16.565Z
Learning: WooCommerce legacy JavaScript files in plugins/woocommerce/client/legacy/js/ must use older JavaScript syntax and cannot use modern features like optional chaining (?.) due to browser compatibility requirements. Explicit null checking with && operators should be used instead.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: mreishus
PR: #58891
File: plugins/woocommerce/src/Blocks/Utils/BlocksSharedState.php:0-0
Timestamp: 2025-06-16T21:59:26.255Z
Learning: In WooCommerce's CartSchema::get_item_response() method, when called in the context of BlocksSharedState::register_cart_interactivity(), the method returns a plain array rather than a WP_REST_Response object, making it directly suitable for wp_interactivity_state() without needing to call ->get_data().
Learnt from: vladolaru
PR: #58784
File: plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Monei.php:27-33
Timestamp: 2025-06-18T10:01:09.421Z
Learning: In WooCommerce payment gateway provider classes, prefer using is_callable()
over method_exists()
when checking for method availability, as it properly accounts for method visibility (public/private/protected) rather than just existence.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: vladolaru
PR: #58784
File: plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:431-439
Timestamp: 2025-06-17T14:19:30.933Z
Learning: In plugins/woocommerce/src/Internal/Admin/Settings/Payments.php, the process_payment_provider_states() method intentionally filters out payment providers that don't have a _suggestion_id. This is by design to only track state changes for gateways from partner extensions, not core WooCommerce gateways or other installed gateways.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
Learnt from: vladolaru
PR: #59160
File: plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsServiceTest.php:360-373
Timestamp: 2025-06-25T15:39:25.166Z
Learning: Test mocks should accurately simulate the behavior of the functions they replace, including return value semantics. For WordPress functions like update_option
, the mock should properly return false
when the value hasn't changed and true
when it has, to avoid masking logic errors in tests.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: lysyjan
PR: #59070
File: packages/php/email-editor/src/Integrations/Core/class-initializer.php:103-141
Timestamp: 2025-06-23T16:55:58.246Z
Learning: The core/spacer block in the WooCommerce email editor intentionally does not have a dedicated renderer class and is handled by the fallback renderer instead of having an explicit render_email_callback assigned in the switch statement.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/code-quality.mdc)
**/*.{php,js,jsx,ts,tsx}
: Guard against unexpected inputs
Sanitize and validate any potentially dangerous inputs
Ensure code is backwards compatible
Write code that is readable and intuitive
Ensure code has unit or E2E tests where applicable
Files:
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit Configuration File
**/*.{php,js,ts,jsx,tsx}
: Don't trust that extension developers will follow the best practices, make sure the code:
- Guards against unexpected inputs.
- Sanitizes and validates any potentially dangerous inputs.
- Is backwards compatible.
- Is readable and intuitive.
- Has unit or E2E tests where applicable.
Files:
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php
🧠 Learnings (19)
📓 Common learnings
Learnt from: tpaksu
PR: woocommerce/woocommerce#59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Learnt from: gigitux
PR: woocommerce/woocommerce#58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
Learnt from: ralucaStan
PR: woocommerce/woocommerce#58782
File: plugins/woocommerce/client/blocks/assets/js/base/utils/render-frontend.tsx:0-0
Timestamp: 2025-06-16T16:12:12.148Z
Learning: For WooCommerce checkout blocks, lazy loading was removed in favor of direct imports to prevent sequential "popping" effects during component loading. This approach prioritizes user experience over code splitting, with minimal bundle size impact and improved performance (1.7s to 1.1s speed score improvement). The checkout flow benefits from having all components load together rather than incrementally.
plugins/woocommerce/changelog/59869-fix-fulfillments-load-text-domain-warning (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: jorgeatorres
PR: #59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in plugins/woocommerce/changelog/
directory and are processed during releases, not at the repository root level.
Learnt from: opr
PR: woocommerce/woocommerce#0
File: :0-0
Timestamp: 2025-06-20T17:38:16.565Z
Learning: WooCommerce legacy JavaScript files in plugins/woocommerce/client/legacy/js/ must use older JavaScript syntax and cannot use modern features like optional chaining (?.) due to browser compatibility requirements. Explicit null checking with && operators should be used instead.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
plugins/woocommerce/tests/php/includes/class-wc-tax-test.php (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: mreishus
PR: #58891
File: plugins/woocommerce/src/Blocks/Utils/BlocksSharedState.php:0-0
Timestamp: 2025-06-16T21:59:26.255Z
Learning: In WooCommerce's CartSchema::get_item_response() method, when called in the context of BlocksSharedState::register_cart_interactivity(), the method returns a plain array rather than a WP_REST_Response object, making it directly suitable for wp_interactivity_state() without needing to call ->get_data().
Learnt from: vladolaru
PR: #58784
File: plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Monei.php:27-33
Timestamp: 2025-06-18T10:01:09.421Z
Learning: In WooCommerce payment gateway provider classes, prefer using is_callable()
over method_exists()
when checking for method availability, as it properly accounts for method visibility (public/private/protected) rather than just existence.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: vladolaru
PR: #58784
File: plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:431-439
Timestamp: 2025-06-17T14:19:30.933Z
Learning: In plugins/woocommerce/src/Internal/Admin/Settings/Payments.php, the process_payment_provider_states() method intentionally filters out payment providers that don't have a _suggestion_id. This is by design to only track state changes for gateways from partner extensions, not core WooCommerce gateways or other installed gateways.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php (3)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
Learnt from: vladolaru
PR: #59160
File: plugins/woocommerce/tests/php/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsServiceTest.php:360-373
Timestamp: 2025-06-25T15:39:25.166Z
Learning: Test mocks should accurately simulate the behavior of the functions they replace, including return value semantics. For WordPress functions like update_option
, the mock should properly return false
when the value hasn't changed and true
when it has, to avoid masking logic errors in tests.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: gigitux
PR: #58846
File: plugins/woocommerce/client/blocks/tests/e2e/tests/all-products/all-products.block_theme.spec.ts:41-52
Timestamp: 2025-06-16T09:20:22.981Z
Learning: In WooCommerce E2E tests, the database is reset to the initial state for each test, so there's no need to manually restore global template changes (like clearing the header template) as the test infrastructure handles cleanup automatically.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php (2)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
Learnt from: lysyjan
PR: #59070
File: packages/php/email-editor/src/Integrations/Core/class-initializer.php:103-141
Timestamp: 2025-06-23T16:55:58.246Z
Learning: The core/spacer block in the WooCommerce email editor intentionally does not have a dedicated renderer class and is handled by the fallback renderer instead of having an explicit render_email_callback assigned in the switch statement.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php (1)
Learnt from: tpaksu
PR: #59172
File: plugins/woocommerce/src/Internal/Fulfillments/Providers/MPLShippingProvider.php:14-21
Timestamp: 2025-06-26T10:47:27.212Z
Learning: In the WooCommerce fulfillments system, only the UPS shipping provider is currently fully implemented. All other shipping provider classes in plugins/woocommerce/src/Internal/Fulfillments/Providers/ are placeholders for future implementations, so empty shipping country arrays and stub methods in these classes are intentional and should not be flagged as issues.
🔇 Additional comments (33)
plugins/woocommerce/changelog/59869-fix-fulfillments-load-text-domain-warning (1)
1-4
: LGTM! Changelog entry accurately describes the fix.The changelog entry properly categorizes this as a patch-level fix and accurately describes the issue being resolved - load text domain warnings caused by fulfillments classes loading the features controller before it was fully initialized.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/OrderFulfillmentsRestControllerTest.php (1)
56-58
: LGTM! Test correctly reflects the new initialization pattern.The test properly adapts to the refactored fulfillments lifecycle by:
- Retrieving the controller from the container
- Explicitly calling
register()
to register hooks- Calling
initialize_fulfillments()
to complete initializationThis ensures the test environment matches the production code's deferred initialization pattern.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsManager.php (1)
25-27
: LGTM! Clean refactor from constructor to explicit registration.The method rename from
__construct()
toregister()
improves the lifecycle management by:
- Separating object instantiation from hook registration
- Providing explicit control over when hooks are registered
- Maintaining the same functionality while improving clarity
The updated PHPDoc appropriately reflects the method's purpose as a hook registration function.
plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsSettings.php (1)
16-18
: LGTM! Consistent application of the registration pattern.The constructor-to-
register()
method refactor maintains the same hook registration functionality while providing explicit control over when initialization occurs. The updated PHPDoc correctly describes the method's purpose.plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsManagerTest.php (2)
28-30
: LGTM! Test setup properly implements the new initialization pattern.The test correctly adapts to the refactored lifecycle by storing the controller in a variable and explicitly calling both
register()
andinitialize_fulfillments()
to ensure complete setup before tests run.
46-47
: LGTM! Manager initialization follows the new pattern.The test properly retrieves the manager from the container and explicitly calls
register()
instead of relying on constructor side effects, which aligns with the architectural changes in the production code.plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentUtilsTest.php (1)
17-19
: LGTM! Proper fulfillments controller initialization pattern.The change correctly implements the new deferred initialization approach by calling both
register()
andinitialize_fulfillments()
on the controller instance. This ensures the fulfillments feature is fully initialized in the test environment.plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsRenderer.php (1)
29-56
: LGTM! Clean refactor from constructor to explicit registration.The renaming from
__construct()
toregister()
correctly implements the new explicit hook registration pattern. The functionality remains identical - all the same hooks are registered with proper conditions for HPOS vs legacy order tables.plugins/woocommerce/tests/php/includes/class-wc-emails-tests.php (1)
72-75
: LGTM! Consistent fulfillments initialization pattern.The change correctly implements the same initialization pattern used across other test files, ensuring the fulfillments controller is fully registered and initialized before testing fulfillment meta functionality.
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreHookTest.php (1)
35-37
: LGTM! Proper controller initialization for fulfillment hook tests.The change correctly implements the established initialization pattern, ensuring the fulfillments controller is fully registered and initialized before running tests that depend on fulfillment data store hooks.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentTest.php (1)
20-22
: LGTM! Standard fulfillments initialization pattern implemented.The change correctly follows the established initialization pattern used across all fulfillment test files, ensuring the controller is properly registered and initialized before testing Fulfillment object functionality.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/ShippingProvidersTest.php (1)
18-21
: LGTM! Proper initialization sequence implemented.The test correctly follows the new fulfillments initialization pattern: enabling the feature, retrieving the controller from the container, registering it, and then explicitly calling
initialize_fulfillments()
. This aligns with the architectural changes to defer initialization and prevent early text domain loading warnings.plugins/woocommerce/tests/php/src/Internal/Fulfillments/TrackingNumbersTest.php (1)
24-28
: LGTM! Consistent initialization pattern applied.The setUp method correctly implements the new fulfillments initialization sequence and retrieves the FulfillmentsManager from the container instead of direct instantiation. This ensures proper dependency management and aligns with the deferred initialization approach.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsSettingsTest.php (3)
24-26
: LGTM! Controller properly initialized with deferred approach.The test correctly implements the new initialization sequence by retrieving the controller from the container, registering it, and then calling
initialize_fulfillments()
. This supports the architectural change to prevent early text domain loading.
41-41
: LGTM! Consistent container-managed instance usage.The test methods correctly retrieve
FulfillmentsSettings
instances from the container instead of direct instantiation, ensuring proper dependency management and lifecycle consistency.Also applies to: 62-62, 82-82, 101-101, 159-159, 228-228, 239-239
254-254
: LGTM! Mock properly calls register() method.The mock object correctly calls the
register()
method, reflecting the architectural change where fulfillment classes use explicit registration instead of constructor-based initialization.plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRefundTest.php (2)
38-41
: LGTM! Clean initialization with improved variable naming.The controller initialization follows the proper sequence and the variable naming (
$controller
instead of$fulfillments_controller
) is more concise while maintaining clarity.
58-59
: LGTM! Proper container-managed FulfillmentsManager setup.The manager is correctly retrieved from the container and explicitly registered, aligning with the new lifecycle management approach for fulfillment classes.
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererTest.php (4)
19-24
: LGTM! Well-structured property addition.The addition of a private
FulfillmentsRenderer
property with proper type declaration improves the test class structure and enables consistent renderer usage across test methods.
32-34
: LGTM! Proper controller initialization sequence.The controller is correctly initialized with the new deferred approach, calling both
register()
andinitialize_fulfillments()
to ensure proper setup before tests run.
48-51
: LGTM! Consistent renderer setup with explicit registration.The setUp method properly retrieves the renderer from the container and explicitly calls
register()
, ensuring consistent initialization across all test methods.
58-58
: LGTM! Consistent container-managed instance usage throughout tests.The test methods consistently retrieve
FulfillmentsRenderer
instances from the container, ensuring proper dependency management and alignment with the new lifecycle approach.Also applies to: 97-97, 119-119, 140-140, 152-152, 164-164, 176-176, 205-205, 248-248, 295-295
plugins/woocommerce/tests/php/src/Internal/DataStores/Fulfillments/FulfillmentsDataStoreTest.php (4)
22-22
: Good refactoring from static to instance property.This change improves test isolation by ensuring each test gets its own data store instance rather than sharing a static one across all tests.
30-32
: Properly implements the new deferred initialization pattern.The changes correctly retrieve the FulfillmentsController from the container, register it, and then explicitly initialize fulfillments. This addresses the load text domain warning mentioned in the PR objectives.
46-59
: Excellent addition of proper test lifecycle methods.The setUp method correctly retrieves the data store from the container for each test instance, while the tearDown method ensures proper database cleanup between tests. This improves test isolation and prevents test interdependencies.
82-662
: Consistent property reference updates throughout all test methods.All references to the static data store property have been properly updated to use the instance property
$this->data_store
. The changes are consistent and maintain the same test logic while improving test isolation.plugins/woocommerce/src/Internal/Fulfillments/FulfillmentsController.php (3)
31-33
: Properly implements deferred initialization pattern.The register() method correctly hooks the initialization to WordPress 'init' action, ensuring the fulfillments feature initializes after WordPress is fully loaded. This addresses the load text domain warning mentioned in the PR objectives.
39-58
: Excellent implementation of lazy initialization with proper feature gating.The method correctly retrieves dependencies from the container at runtime, checks the feature flag before proceeding, and maintains the same initialization logic as before but with deferred execution. This resolves dependency timing issues.
81-85
: Consistent application of lazy dependency retrieval pattern.The DatabaseUtil is now properly retrieved from the container at runtime instead of being stored as a class property. This maintains the same functionality while following the new lazy loading approach.
Also applies to: 113-113
plugins/woocommerce/tests/php/src/Internal/Fulfillments/FulfillmentsRendererHooksTest.php (4)
23-45
: Well-structured test setup following the new initialization pattern.The test class correctly enables the fulfillments feature, initializes the controller using the new deferred pattern, and retrieves the renderer from the container. The teardown properly disables the feature for cleanup.
50-67
: Comprehensive testing of HPOS-enabled hook registration.The test properly mocks the CustomOrdersTableController, verifies all expected hooks are registered when HPOS is enabled, and correctly resets the container replacement for test isolation. The hook assertions cover all the key functionality.
72-89
: Proper testing of legacy environment hook registration.The test ensures backward compatibility by verifying that legacy-specific hooks are properly registered when HPOS is disabled. The different hook names appropriately reflect the legacy vs modern order table environments.
94-129
: Thorough coverage of admin initialization hooks.The tests verify that bulk action hooks are properly registered after calling init_admin_hooks in both HPOS and legacy environments. The test structure is consistent and ensures comprehensive coverage of admin functionality.
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, works as explained in the testing instructions.
* Load fulfillments classes in init action hook * Add changefile(s) from automation for the following project(s): woocommerce * Small change to restart tests * Remove two consecutive empty lines --------- Co-authored-by: github-actions <github-actions@github.com>
* Load fulfillments classes in init action hook * Add changefile(s) from automation for the following project(s): woocommerce * Small change to restart tests * Remove two consecutive empty lines --------- Co-authored-by: github-actions <github-actions@github.com>
* Load fulfillments classes in init action hook (#59869) * Load fulfillments classes in init action hook * Add changefile(s) from automation for the following project(s): woocommerce * Small change to restart tests * Remove two consecutive empty lines --------- Co-authored-by: github-actions <github-actions@github.com> * Add changefile(s) from automation for the following project(s): woocommerce * Remove extra changefile --------- Co-authored-by: github-actions <github-actions@github.com>
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR moves the class initializations of the fulfillments feature to the init action hook, and fixes the tests. (Also fixes one warning surfacing on the test runs, not related with this problem.)
Closes #59870 WOOPLUG-5128
(For Bug Fixes) Bug introduced in PR #57353
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Before this PR, when you go to any page, you'll get a warning on your error log file saying that load text domain was called early. After applying these changes, you should see the warning is gone.
Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment
Fix load text domain warnings caused by fulfillments class loading features controller before fully initialized.