public function testClear() { $store = m::mock('Cart\\Storage\\Store'); $store->shouldReceive('flush')->times(1); $cart = new Cart('foo', $store); $item1 = new CartItem(array('name' => 'foo')); $item2 = new CartItem(array('name' => 'bar')); $cart->add($item1); $cart->add($item2); $cart->clear(); $cartItems = $cart->all(); $this->assertTrue(count($cartItems) == 0); }