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.
 }
예제 #2
0
 /**
  * @return string
  */
 public function setquantityLink()
 {
     $buyable = $this->Buyable();
     return $buyable ? ShoppingCart_Controller::set_quantity_item_link($buyable, $this->uniquedata()) : '';
 }
 /**
  * set new specific new quantity for buyable's orderitem
  * @param double
  * @return String (Link)
  */
 function SetSpecificQuantityItemLink($quantity)
 {
     return ShoppingCart_Controller::set_quantity_item_link($this->ID, $this->ClassName, array_merge($this->linkParameters(), array("quantity" => $quantity)));
 }
예제 #4
0
파일: OrderItem.php 프로젝트: 8secs/cocina
 public function setquantityLink()
 {
     return ShoppingCart_Controller::set_quantity_item_link($this->Buyable(), $this->uniquedata());
 }
예제 #5
0
 function setquantityLink()
 {
     return ShoppingCart_Controller::set_quantity_item_link($this->_productID);
 }
 /**
  *
  * @return String
  */
 protected function getQuantityLink()
 {
     return ShoppingCart_Controller::set_quantity_item_link($this->orderItem->BuyableID, $this->orderItem->BuyableClassName, $this->parameters);
 }
 public function testRemoveFromCart()
 {
     // add items via url
     $this->get(ShoppingCart_Controller::set_quantity_item_link($this->mp3player, array('quantity' => 5)));
     $this->get(ShoppingCart_Controller::add_item_link($this->socks));
     // remove items via url
     $r = $this->get(ShoppingCart_Controller::remove_item_link($this->socks), null, $this->ajaxHeaders);
     //remove one different = remove completely
     $data = json_decode($r->getBody(), true);
     $this->assertNotEmpty($data[AjaxHTTPResponse::EVENTS_KEY]['cartremove']);
     $this->assertFalse($this->cart->get($this->socks));
     $r = $this->get(ShoppingCart_Controller::remove_item_link($this->mp3player));
     //remove one product = 4 left
     $this->assertFalse($r instanceof AjaxHTTPResponse);
     $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.
 }