@@ 30-40 (lines=11) @@ | ||
27 | $this->assertContains($product, $cart->getItems()); |
|
28 | } |
|
29 | ||
30 | public function testRemoveItem() |
|
31 | { |
|
32 | $cart = Yii::$app->cart; |
|
33 | $product = Product::findOne(1); |
|
34 | $cart->add($product); |
|
35 | ||
36 | $this->assertContains($product, $cart->getItems()); |
|
37 | ||
38 | $cart->remove($product->getUniqueId()); |
|
39 | $this->assertEmpty($cart->getItems()); |
|
40 | } |
|
41 | ||
42 | public function testClearCart() |
|
43 | { |
|
@@ 42-52 (lines=11) @@ | ||
39 | $this->assertEmpty($cart->getItems()); |
|
40 | } |
|
41 | ||
42 | public function testClearCart() |
|
43 | { |
|
44 | $cart = Yii::$app->cart; |
|
45 | $product = Product::findOne(1); |
|
46 | $cart->add($product); |
|
47 | ||
48 | $this->assertEquals(1, $cart->getCount()); |
|
49 | ||
50 | $cart->clear(); |
|
51 | $this->assertEmpty($cart->getItems()); |
|
52 | } |
|
53 | ||
54 | public function testGetAttributeTotalValue() |
|
55 | { |