Skip to content

Commit

Permalink
adding another test case for coupons
Browse files Browse the repository at this point in the history
  • Loading branch information
AdiCherukuri committed Dec 20, 2016
1 parent 3c912f5 commit 5a623a2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/CouponsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,29 @@ public function testSetDiscountOnItem()
$this->assertCount(0, $item->couponInfo);
}

/**
* Test cart percentage coupon when items are not taxable
*/
public function testCouponsNotTaxableItem()
{
$this->addItem(1, 1, false);

$percentCoupon = new LukePOLO\LaraCart\Coupons\Percentage('20%OFF', '.2');

$this->laracart->addCoupon($percentCoupon);

$this->assertEquals($percentCoupon, $this->laracart->findCoupon('20%OFF'));

$this->assertEquals('20%', $percentCoupon->displayValue());
$this->assertEquals('0.20', $percentCoupon->discount());

$this->app['config']->set('laracart.discountTaxable', false);

$this->assertEquals(0, $this->laracart->taxTotal(false));

$this->assertEquals('0.80', $this->laracart->total(false));
}

/**
* Test if we can remove all coupons from the cart.
*/
Expand Down

0 comments on commit 5a623a2

Please sign in to comment.