Commit Graph
55 Commits
Author SHA1 Message Date
Joel Male 01189993f2 feat: add applies_to support for quantity-limited item conditions 2026-06-13 14:27:42 +10:00
Joel Male 88a118d81b feat: make SessionDriver constructor args optional with app() defaults
new SessionDriver() now works out of the box in a Laravel app, resolving
the session and session ID from the container. Explicit args still work
as before. Also ignores .claude/ directory from version control.
2026-05-28 09:25:41 +10:00
Joel Male c2b2563cf1 feat: add cart:debug command 2026-05-27 21:44:47 +10:00
Joel Male 15d4397968 feat: add cart:make:driver command 2026-05-27 21:43:59 +10:00
Joel Male 76fba35643 feat: add cart:make:shipping command 2026-05-27 21:43:34 +10:00
Joel Male b8140166c9 feat: add cart:make:tax command 2026-05-27 21:43:14 +10:00
Joel Male fc16e6c877 feat: add cart:make:coupon command 2026-05-27 21:42:51 +10:00
Joel Male 731aaa070d feat: add cart:install command 2026-05-27 21:42:28 +10:00
Joel Male 0efd4378a8 feat: add HasCart trait and ShareCartWithInertia 2026-05-27 21:38:44 +10:00
Joel Male a485bfb6f0 refactor: use assertEqualsWithDelta for float comparisons, add @internal to fake()
Replace Assert::assertEquals with Assert::assertEqualsWithDelta (epsilon 0.0001)
in assertSubTotal, assertTotal, and assertTotalQuantity to avoid IEEE 754
floating-point equality pitfalls. Add @internal docblock to fake() to signal
it is test-only. Add regression test for consecutive withItems calls.
2026-05-27 21:35:49 +10:00
Joel Male 8d04d18b48 test: add withCoupon test and fix withItems ID collision 2026-05-27 21:33:35 +10:00
Joel Male 61863e0bd5 feat: add Cart::fake(), assertion methods, and CartFactory
Adds Cart::fake() which swaps the active driver to NullDriver and returns
a CartFactory fluent test builder. Adds assertion methods (assertContains,
assertCount, assertTotalQuantity, assertSubTotal, assertTotal,
assertConditionApplied, assertEmpty, assertNotEmpty) to Cart for use in
tests. CartFactory provides withItems(), withCondition(), and withCoupon()
as chainable helpers for seeding cart state.
2026-05-27 21:31:54 +10:00
Joel Male c3a734bd7f feat: add Cart::coupon(), Cart::tax(), Cart::shipping()
Proxy methods that accept first-class Coupon, TaxRule, and ShippingRate
objects and delegate to Cart::condition() via toCondition().
2026-05-27 21:27:23 +10:00
Joel Male 2513e07436 feat: add ShippingRate base class 2026-05-27 21:24:44 +10:00
Joel Male b5edbb8ec0 feat: add TaxRule base class 2026-05-27 21:24:09 +10:00
Joel Male 867daaf328 feat: add Coupon base class 2026-05-27 21:23:39 +10:00
Joel Male 4877911cdd fix: serialize conditions to arrays before storage; type \$events
- serializeConditions() now maps CartCondition objects to arrays via
  toArray() before passing to the driver, preventing json_encode()
  producing {} for object values in the DatabaseDriver
- Add Dispatcher type hint to \$events property and constructor parameter
- Add database round-trip test for cart-level conditions
- Fix CartConditionsTest to retrieve condition objects from the cart
  rather than relying on object-reference side-effects that no longer
  hold after proper serialization
2026-05-27 21:21:44 +10:00
Joel Male 0c27ac4d9a test: update existing tests to use CartDriver 2026-05-27 21:09:40 +10:00
Joel Male 71213d51f5 fix: null-safe json_decode in RedisDriver; add getSessionModel test to MultiDriverTest 2026-05-27 21:01:34 +10:00
Joel Male 83aa9a1431 feat: add MultiDriver 2026-05-27 20:59:45 +10:00
Joel Male 9fcd50f81f test: add setSessionKey test to DatabaseDriverTest 2026-05-27 20:58:24 +10:00
Joel Male 4702cf98ab feat: add DatabaseDriver
Implements CartDriver for Eloquent-backed persistence using firstOrNew
pattern. Includes 9 unit tests covering CRUD, flush, clearItems, and
model retrieval.
2026-05-27 20:55:01 +10:00
Joel Male 8927ef08a0 fix: guard null writes in SessionDriver::setSessionKey 2026-05-27 20:53:19 +10:00
Joel Male c9f48d7e88 feat: add SessionDriver 2026-05-27 20:50:47 +10:00
Joel Male 11e23a946e test: fix strict_types and test name in NullDriverTest 2026-05-27 20:49:36 +10:00
Joel Male b3c4c53e63 feat: add NullDriver 2026-05-27 20:47:14 +10:00
Joel Male 8f442f51e0 chore: migrate to wearepixel/laravel-cart 2026-03-24 14:04:48 +10:00
Joel Male 4c02310bf7 feat: rough session re-implementation 2025-04-14 16:53:35 +10:00
Joel Male 4cf078277d feat: finish tests & docs 2025-02-25 16:54:03 +10:00
Joel Male 7adf5ecd1f feat: add tests and fix item level conditions for database storage 2025-02-25 16:31:42 +10:00
Joel Male 0f07b9ae8a feat: database support 2025-02-25 16:03:17 +10:00
Joel Male ec99aa0563 feat: clean up and starting documentation 2025-02-25 14:53:49 +10:00
Joel Male b92dce9ca4 wip: initial working database support 2025-02-25 11:47:10 +10:00
Joel Male 599051631c wip: rename package to joelwmale 2024-11-28 13:06:24 +10:00
Joel Male 5505f121c7 fix subtotal always being used 2024-09-23 07:45:59 +10:00
Joel Male 472d505041 wip: fix issue with conditions not being properly removed 2024-09-18 15:56:12 +10:00
Pixel Tech b7381573e8 Apply Laravel Pint
Signed-off-by: Pixel Tech <tech@wearepixel.com.au>
2024-09-08 02:21:01 +00:00
Joel Male d4d4df7d58 pint fixes 2024-09-08 12:20:36 +10:00
Pixel Tech 6ea2cb3b8b Apply Laravel Pint
Signed-off-by: Pixel Tech <tech@wearepixel.com.au>
2024-09-07 22:36:00 +00:00
Joel Male 7a2c41e02d add better livewire support
- and reset collection indexes properly
2024-09-08 08:32:51 +10:00
Joel Male ab9eb6c873 fix tests 2024-09-04 09:16:15 +10:00
Joel Male 7ee26add8d undo extra changes 2024-09-04 09:14:23 +10:00
Joel Male 05318b7b13 working on deprecations and code cleanup 2024-09-03 21:41:45 +10:00
Joel Male a269c188e4 initial functionality 2024-09-03 20:22:03 +10:00
Joel Male 313a4f7aa2 Revert "1.0.7"
This reverts commit 4a312a37e2.
2024-08-30 10:08:27 +10:00
Joel Male 4a312a37e2 1.0.7 2024-08-30 09:44:40 +10:00
Joel Male 6604cf984d fix tests & validation errors 2024-08-26 10:57:02 +10:00
Joel Male 54d94d8d12 Add items with no price 2024-08-26 10:38:20 +10:00
Joel Male f6447ad4d9 feat: add failing tests 2024-08-20 16:57:06 +10:00
Joel Male b102dd2356 1.0.3 2024-08-19 10:35:54 +10:00