\SWS_CartTest
Testing {@link Product}s added and removed from {@link Order}s.
Summary of tests:
-----------------
add product to cart
change quantity of product in cart
update product and add it to cart again checking version number
add negative quantity to cart
add 0 quantity to cart
try saving duplicate variations
try saving variation without full set of options
change product price after it is in the cart
cannot add non-published product to the cart
customer members can add stuff to carts
website visitors can add stuff to carts
add product to cart and change price
add product variation
change quantity of variation
add different variations for same product
add product and variation to cart and check version
add variation to cart with price change
check cart totals
TODO
----
remove options from product and variaiton when the attribute is deleted
Test saving a product with a new attribute, existing variations without this attribute should be disabled
- Author: Frank Mullenger <frankmullenger@gmail.com>
- Copyright: Copyright (c) 2011, Frank Mullenger
Synopsis
- // Inherited members from SWS_Test
- protected static string $fixture_file;
- protected static boolean $disable_themes;
- protected static boolean $use_draft_site;
- // methods
- public void setUp()
- public void testProduct()
- public void testAddProductToCart()
- public void testAddProductQuantityToCart()
- public void testAddProductNegativeQuantityToCart()
- public void testAddProductZeroQuantityToCart()
- public void testAddProductVersionToCart()
- public void testAddProductToCartLoggedOut()
- public void testAddProductToCartLoggedInCustomer()
- public void testAddProductToCartChangePrice()
- public void testAddProductVariationToCart()
- public void testAddDisabledProductVariationToCart()
- public void testAddInvalidProductVariationToCart()
- public void testAddProductNoVariation()
- public void testAddProductVariationQuantity()
- public void testAddProductVariations()
- public void testAddVariationWithVersion()
- public void testAddVariationWithPriceChanged()
- public void testProductVariationOptions()
- public void testSaveDuplicateProductVariation()
- public void testCartTotals()
- public void testPersistOrder()
- public void testPersistOrderOnAddToCart()
- public void testDeleteAbandonedCarts()
- public void testSaveInvalidProductVariation()
- public void testSetDraftTrue()
- public void testAddNonPublishedProductToCart()
- // Inherited methods from SWS_Test
- public void setUp()
- public void logOut()
- public Array getFormData()
- public Array getFormDataNested()
- public Array searchNestedArray()
- public void testSWS()
Hierarchy
Extends
Members
protected
- $disable_themes
- $fixture_file
- $use_draft_site
Methods
public
- setUp()
- testAddDisabledProductVariationToCart() — Add disabled product variation to cart should not work
- testAddInvalidProductVariationToCart() — Add invalid product variation to cart should not work
- testAddNonPublishedProductToCart() — Adding non published product to a cart should fail
- testAddProductNegativeQuantityToCart() — Add negative quantity to cart, should have no effect on cart
- testAddProductNoVariation()
- testAddProductQuantityToCart() — Add product to the cart twice and check quantity
- testAddProductToCart() — Add an item to the cart for a basic product and check correct product added
- testAddProductToCartChangePrice() — Change product price after it is in the cart, check that price has not changed in cart
- testAddProductToCartLoggedInCustomer() — Add a product logged in as a customer
- testAddProductToCartLoggedOut() — Add a product to the cart as a visitor to the website
- testAddProductVariationQuantity() — Add product variations and check quantities
- testAddProductVariationToCart() — Add a product variation to the cart
- testAddProductVariations() — Add different product variations for the same product
- testAddProductVersionToCart() — Published products should get different versions, new versions are new items in the cart
- testAddProductZeroQuantityToCart() — Adding product with zero quantity should have no effect on cart
- testAddVariationWithPriceChanged() — Add product variation with different price and check order total
- testAddVariationWithVersion() — Add product variations and check version correct
- testCartTotals() — Add product and variation with quantity to cart and check total and subtotal
- testDeleteAbandonedCarts() — Carts abandoned longer than set lifetime are deleted
- testPersistOrder() — Persist an order to the DB only when explicitly asked to
- testPersistOrderOnAddToCart() — Order is persisted to DB when trying to add a product to the cart
- testProduct() — Create product and check basic attributes
- testProductVariationOptions() — Get variation options and test that they are correct
- testSaveDuplicateProductVariation() — Test saving duplicate product variations
- testSaveInvalidProductVariation() — Test saving variation without all options set Disabled validation for product variations because preventing disabling a variation
- testSetDraftTrue() — Have to use draft site for following test testAddNonPublishedProductToCart
Inherited from SWS_Test
public
- getFormData() — Helper to get data from a form.
- getFormDataNested() — Helper to get data from a form in a nested array instead of just flat. Useful for post() calls.
- logOut() — Log current member out by clearing session
- searchNestedArray() — Search a nested array for key => value pair
- setUp()
- testSWS()