mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Changed $taxRate from private to public, Solve https://github.com/Crinsane/LaravelShoppingcart/issues/436
This commit is contained in:
@@ -58,6 +58,13 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
*/
|
*/
|
||||||
public $options;
|
public $options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tax rate for the cart item.
|
||||||
|
*
|
||||||
|
* @var int|float
|
||||||
|
*/
|
||||||
|
public $taxRate = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FQN of the associated model.
|
* The FQN of the associated model.
|
||||||
*
|
*
|
||||||
@@ -65,13 +72,6 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
*/
|
*/
|
||||||
private $associatedModel = null;
|
private $associatedModel = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* The tax rate for the cart item.
|
|
||||||
*
|
|
||||||
* @var int|float
|
|
||||||
*/
|
|
||||||
private $taxRate = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The discount rate for the cart item.
|
* The discount rate for the cart item.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -756,6 +756,20 @@ class CartTest extends TestCase
|
|||||||
$this->assertEquals('1.050,00', $cart->tax(2, ',', '.'));
|
$this->assertEquals('1.050,00', $cart->tax(2, ',', '.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
public function it_can_access_tax_as_percentage()
|
||||||
|
{
|
||||||
|
$cart = $this->getCart();
|
||||||
|
|
||||||
|
$cart->add(new BuyableProduct(1, 'Some title', 10.00), 1);
|
||||||
|
|
||||||
|
$cart->setTax('027c91341fd5cf4d2579b49c4b6a90da', 19);
|
||||||
|
|
||||||
|
$cartItem = $cart->get('027c91341fd5cf4d2579b49c4b6a90da');
|
||||||
|
|
||||||
|
$this->assertEquals(19, $cartItem->taxRate);
|
||||||
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_can_return_the_subtotal()
|
public function it_can_return_the_subtotal()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user