Skip to content

Commit 913728f

Browse files
committed
fix infect
1 parent 0f355e1 commit 913728f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Units/Domain/CartTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,29 @@
2626
*/
2727
final class CartTest extends TestCase
2828
{
29+
public function testCartClone(): void
30+
{
31+
/** @var ItemMeta $product */
32+
$product = ItemMetaFactory::new()->create([
33+
'quantity' => 1,
34+
]);
35+
36+
$cart = app(Cart::class);
37+
38+
$cartWithItems = $cart->withItems([$product]);
39+
$cartWithMeta = $cart->withMeta([
40+
'product_id' => $product->getKey(),
41+
]);
42+
43+
self::assertCount(0, $cart->getItems());
44+
self::assertCount(1, $cartWithItems->getItems());
45+
46+
self::assertSame([], $cart->getMeta());
47+
self::assertSame([
48+
'product_id' => $product->getKey(),
49+
], $cartWithMeta->getMeta());
50+
}
51+
2952
public function testCartMeta(): void
3053
{
3154
/**

0 commit comments

Comments
 (0)