ShoppingCart_Controller::set_quantity_item_link PHP Method

    public static function set_quantity_item_link(Buyable $buyable, $parameters = array())
    {
        return self::build_url("setquantity", $buyable, $parameters);
    }

Usage Example

 public function testRemoveFromCart()
 {
     // add items via url
     $this->get(ShoppingCart_Controller::set_quantity_item_link($this->mp3player, array('quantity' => 5)));
     $this->assertTrue($this->cart->get($this->mp3player) !== false, "mp3player item now exists in cart");
     $this->get(ShoppingCart_Controller::add_item_link($this->socks));
     $this->assertTrue($this->cart->get($this->socks) !== false, "socks item now exists in cart");
     // remove items via url
     $this->get(ShoppingCart_Controller::remove_item_link($this->socks));
     //remove one different = remove completely
     $this->assertFalse($this->cart->get($this->socks));
     $this->get(ShoppingCart_Controller::remove_item_link($this->mp3player));
     //remove one product = 4 left
     $mp3playeritem = $this->cart->get($this->mp3player);
     $this->assertTrue($mp3playeritem !== false, "product still exists");
     $this->assertEquals($mp3playeritem->Quantity, 4, "only 4 of item left");
     $items = ShoppingCart::curr()->Items();
     $this->assertNotNull($items, "Cart is not empty");
     $this->cart->clear();
     //test clearing cart
     $this->assertEquals(ShoppingCart::curr(), null, 'Cart is clear');
     //items is a databoject set, and will therefore be null when cart is empty.
 }
All Usage Examples Of ShoppingCart_Controller::set_quantity_item_link