This reverts commit 5d117a0acd.
This commit is contained in:
Patrick Henninger
2019-01-09 12:22:25 +01:00
parent 13238f9883
commit 55f1c4617f
7 changed files with 21 additions and 211 deletions

View File

@@ -22,7 +22,7 @@ class CartItemTest extends TestCase
/** @test */
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', 10.00, ['size' => 'XL', 'color' => 'red']);
$cartItem->setQuantity(2);
$this->assertEquals([
@@ -37,20 +37,19 @@ class CartItemTest extends TestCase
],
'tax' => 0,
'subtotal' => 20.00,
'discount' => 0.0,
'weight' => 550.0
'discount' => 0.0
], $cartItem->toArray());
}
/** @test */
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', 10.00, ['size' => 'XL', 'color' => 'red']);
$cartItem->setQuantity(2);
$this->assertJson($cartItem->toJson());
$json = '{"rowId":"07d5da5550494c62daf9993cf954303f","id":1,"name":"Some item","qty":2,"price":10,"weight":550,"options":{"size":"XL","color":"red"},"discount":0,"tax":0,"subtotal":20}';
$json = '{"rowId":"07d5da5550494c62daf9993cf954303f","id":1,"name":"Some item","qty":2,"price":10,"options":{"size":"XL","color":"red"},"discount":0,"tax":0,"subtotal":20}';
$this->assertEquals($json, $cartItem->toJson());
}