Add unit tests for the address-request guard and ajax response#110
Open
boo-code wants to merge 3 commits into
Open
Add unit tests for the address-request guard and ajax response#110boo-code wants to merge 3 commits into
boo-code wants to merge 3 commits into
Conversation
PrestaShop#91 (test/gift-wrapping-handler-coverage) is the dedicated gift-wrapping handler test and covers the same handler more fully (cart-not-loaded, gift disabled, message stored when enabled, and message cleared when disabled). Keeping a second OpcGiftWrappingHandlerTest here only duplicated that coverage, so this PR now focuses on the address-request guard and the ajax response helper.
Contributor
Author
|
Trimmed the scope: dropped the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CheckoutAddressRequestGuardcarried branching logic with no unit test;CheckoutAjaxResponseis the shared error/validation response shape. Covered: the guard's two early-return branches ofisOwnedCheckoutAddress(non-positive address id, unresolved customer) and every branch ofapplyTemporaryInlineInvoiceAddress(billing mirrors delivery, persisted invoice address, missing billing country, and the inline-country mount); and bothCheckoutAjaxResponse::error()/::validation()shapes. Tests only — no production code changes. The gift-wrapping handler test this PR originally also carried has been dropped: #91 is the dedicated gift-wrapping test and covers that handler more fully.CheckoutAddressRequestGuardTest,CheckoutAjaxResponseTest) within the established unit-test patterns (mocked collaborators, in-memoryConfiguration, anonymousContext/Cartfakes) and do not reach the database:isOwnedCheckoutAddress'sCustomer::customerHasAddressbranch is intentionally left to the integration suite.php-cs-fixerclean;tests/is outside the module PHPStan paths.