laravel-shop/tests/Feature
Fabian @ Blax Software 8eb1802ef8 feat: promote IsLoanableProduct to MayBeLoanableProduct on Product
Renames the host-attached IsLoanableProduct trait to MayBeLoanableProduct
and mixes it directly into Product, matching the existing MayBePoolProduct
shape. Hosts opt in with a single DEFAULT_TYPE constant — no more manual
`use ...Trait` ceremony to forget:

    class Book extends Product
    {
        public const DEFAULT_TYPE = ProductType::LOANABLE;
    }

The boot hook reads DEFAULT_TYPE on the concrete class and only applies
the LOANABLE creating-defaults (type, status, is_visible, manage_stock)
when it matches; type-specific helpers (checkOutTo, total_quantity,
available_quantity) early-out via isLoanable() so they're harmless on
non-loanable products. checkOutTo now throws NotLoanableProductException
when called on the wrong type, mirroring NotPoolProductException.

Also fixes total_quantity for the loan lifecycle: previously summed every
INCREASE entry in product_stocks, which inflated the displayed total
after each loan cycle because returns fire increaseStock(). Now reports
physical inventory as availableStock + activeLoans.

README gains a Testing section that surfaces the current phpunit summary
line, plus passing and assertion-count badges linking to it.
2026-05-16 12:17:38 +02:00
..
Booking BFI cart / orders 2026-01-05 10:30:21 +01:00
Cart I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
Checkout feat: Enhance traits with strict types and improve method signatures 2026-05-15 20:26:24 +02:00
Loan feat: promote IsLoanableProduct to MayBeLoanableProduct on Product 2026-05-16 12:17:38 +02:00
Pool feat: Enhance traits with strict types and improve method signatures 2026-05-15 20:26:24 +02:00
Pricing I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
Product feat: Enhance traits with strict types and improve method signatures 2026-05-15 20:26:24 +02:00
ProductionBugs BF pool cart bug, R structure 2025-12-30 10:55:06 +01:00
ShopServiceProvider I loanable product type, tiered pricing, lifecycle events, host helpers 2026-05-15 10:27:59 +02:00
Stripe BF pool cart bug, R structure 2025-12-30 10:55:06 +01:00
CommandProductExamplesTest.php BFI cart single item 2025-12-24 19:40:10 +01:00
GetHasMoreAttributeTest.php BFRI cart 2025-12-28 11:12:58 +01:00
HasShoppingCapabilitiesTest.php BFI cart / orders 2026-01-05 10:30:21 +01:00
ShopFacadeTest.php BFI cart single item 2025-12-24 19:40:10 +01:00