Cart\Cart::all PHP Method

all() public method

Retrieve all of the items in the cart.
public all ( ) : cart\CartItem[]
return cart\CartItem[]
    public function all()
    {
        return $this->items;
    }

Usage Example

Beispiel #1
0
 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);
 }