public function test_total_with_multiple_conditions_added_scenario_four()
 {
     $this->fillCart();
     $this->assertEquals(187.49, $this->cart->getSubTotal(), 'Cart should have sub total of 187.49');
     // add condition
     $condition1 = new CartCondition(array('name' => 'COUPON LESS 12.5%', 'type' => 'tax', 'target' => 'subtotal', 'value' => '-12.5%'));
     $condition2 = new CartCondition(array('name' => 'Express Shipping $15', 'type' => 'shipping', 'target' => 'subtotal', 'value' => '+15'));
     $this->cart->condition($condition1);
     $this->cart->condition($condition2);
     // no changes in subtotal as the condition's target added was for total
     $this->assertEquals(187.49, $this->cart->getSubTotal(), 'Cart should have sub total of 187.49');
     // total should be changed
     $this->assertEquals(179.05375, $this->cart->getTotal(), 'Cart should have a total of 179.05375');
 }
Exemplo n.º 2
0
 /**
  * the new total in which conditions are already applied
  *
  * @return float 
  * @static 
  */
 public static function getTotal()
 {
     return \Darryldecode\Cart\Cart::getTotal();
 }