コード例 #1
0
ファイル: Simple.php プロジェクト: indigophp/simple-cart
 /**
  * {@inheritdoc}
  */
 public function addItem(Item $item)
 {
     $id = $item->getId();
     if ($this->hasItem($id)) {
         $currentItem = $this->getItem($id);
         $currentItem->changeQuantity($item->getQuantity());
         return;
     }
     $this->items[$id] = $item;
 }
コード例 #2
0
ファイル: SimpleSpec.php プロジェクト: indigophp/simple-cart
 function it_has_a_quantity(Item $item)
 {
     $item->getId()->willReturn('_ITEM_');
     $item->getQuantity()->willReturn(1);
     $this->addItem($item);
     $this->getQuantity()->shouldReturn(1);
 }