mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Update CartItemTest.php
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Gloudemans\Tests\Shoppingcart;
|
|||||||
use Gloudemans\Shoppingcart\CartItem;
|
use Gloudemans\Shoppingcart\CartItem;
|
||||||
use Gloudemans\Shoppingcart\ShoppingcartServiceProvider;
|
use Gloudemans\Shoppingcart\ShoppingcartServiceProvider;
|
||||||
use Orchestra\Testbench\TestCase;
|
use Orchestra\Testbench\TestCase;
|
||||||
|
use Money\Money;
|
||||||
|
|
||||||
class CartItemTest extends TestCase
|
class CartItemTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -23,7 +24,7 @@ class CartItemTest extends TestCase
|
|||||||
/** @test */
|
/** @test */
|
||||||
public function it_can_be_cast_to_an_array()
|
public function it_can_be_cast_to_an_array()
|
||||||
{
|
{
|
||||||
$cartItem = new CartItem(1, 'Some item', 10.00, 550, ['size' => 'XL', 'color' => 'red']);
|
$cartItem = new CartItem(1, 'Some item', new Money(10.00), 550, ['size' => 'XL', 'color' => 'red']);
|
||||||
$cartItem->setQuantity(2);
|
$cartItem->setQuantity(2);
|
||||||
|
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
@@ -46,7 +47,7 @@ class CartItemTest extends TestCase
|
|||||||
/** @test */
|
/** @test */
|
||||||
public function it_can_be_cast_to_json()
|
public function it_can_be_cast_to_json()
|
||||||
{
|
{
|
||||||
$cartItem = new CartItem(1, 'Some item', 10.00, 550, ['size' => 'XL', 'color' => 'red']);
|
$cartItem = new CartItem(1, 'Some item', new Money(10.00), 550, ['size' => 'XL', 'color' => 'red']);
|
||||||
$cartItem->setQuantity(2);
|
$cartItem->setQuantity(2);
|
||||||
|
|
||||||
$this->assertJson($cartItem->toJson());
|
$this->assertJson($cartItem->toJson());
|
||||||
@@ -59,7 +60,7 @@ class CartItemTest extends TestCase
|
|||||||
/** @test */
|
/** @test */
|
||||||
public function it_formats_price_total_correctly()
|
public function it_formats_price_total_correctly()
|
||||||
{
|
{
|
||||||
$cartItem = new CartItem(1, 'Some item', 10.00, 550, ['size' => 'XL', 'color' => 'red']);
|
$cartItem = new CartItem(1, 'Some item', new Money(10.00), 550, ['size' => 'XL', 'color' => 'red']);
|
||||||
$cartItem->setQuantity(2);
|
$cartItem->setQuantity(2);
|
||||||
|
|
||||||
$this->assertSame('20.00', $cartItem->priceTotal());
|
$this->assertSame('20.00', $cartItem->priceTotal());
|
||||||
|
|||||||
Reference in New Issue
Block a user