->
stock(100
) ->
price(100
) ->
visibility();
// the product builder has a helper function to write the product values to the database, including all dependencies (rules, currencies, properties, etc)
$product->
write($this->
getContainer());
$context =
$this->
getContext();
$context =
$this->
login($context);
// now we test that the product can be added to a customers cart
$cart =
$this->
addProductToCart($product->id,
$context);
$this->
assertLineItemInCart($cart,
$product->id
);
$this->
assertLineItemUnitPrice($cart,
$product->id, 100
);
$this->
assertLineItemTotalPrice($cart,
$product->id, 100
);
$orderId =
$this->
mailListener(function DMailEventListener
$listener) use ($cart,
$context) { $orderId =
$this->
order($cart,
$context);
$listener->
assertSent('order_confirmation_mail'
);