當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inventory::addItem方法代碼示例

本文整理匯總了PHP中Inventory::addItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inventory::addItem方法的具體用法?PHP Inventory::addItem怎麽用?PHP Inventory::addItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inventory的用法示例。


在下文中一共展示了Inventory::addItem方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testAddItem

 /** @depends testConstruct
  * @depends testConstructItem */
 public function testAddItem()
 {
     $inv = new Inventory(1000, 1);
     $inv->addItem(new InventoryItem(1000, "abc", null, 1, 2, 3, 4, 10));
     $this->assertEquals(1, count($inv->items));
     $item = $inv->items[0];
     $this->assertEquals("abc", $item->productId);
     $this->assertEquals(null, $item->attrSetInstId);
     $this->assertEquals(1, $item->qty);
     $this->assertEquals(2, $item->lostQty);
     $this->assertEquals(3, $item->defectQty);
     $this->assertEquals(4, $item->missingQty);
     $this->assertEquals(10, $item->unitValue);
 }
開發者ID:booko,項目名稱:pasteque-server,代碼行數:16,代碼來源:InventoryTest.php

示例2: testCreateGuessMissingNoStock

 /** @depends testCreateFull */
 public function testCreateGuessMissingNoStock()
 {
     $item = new InventoryItem(null, $this->products[0]->id, null, 1, 2, 3, null, 5);
     $inv = new Inventory(stdtimefstr("2001-01-01 00:00:00"), $this->locations[0]->id);
     $inv->addItem($item);
     $srv = new InventoriesService();
     $id = $srv->create($inv);
     $this->assertNotEquals(false, $id, "Creation failed");
     $pdo = PDOBuilder::getPDO();
     $stmt = $pdo->prepare("SELECT * FROM STOCK_INVENTORYITEM");
     $this->assertNotEquals(false, $stmt->execute(), "Query failed");
     if ($row = $stmt->fetch()) {
         $this->assertEquals(0, $row["MISSINGQTY"]);
         $this->markTestIncomplete("Check unit value");
     } else {
         $this->assertTrue(false, "No inventory item found after creation");
     }
 }
開發者ID:booko,項目名稱:pasteque-server,代碼行數:19,代碼來源:InventoriesServiceTest.php

示例3: testRemoveItem

 /**
  * @covers rvilbrandt\gamebook\Model\Gamebook\Inventory::removeItem
  */
 public function testRemoveItem()
 {
     $this->object->addItem("test", new Inventory\Item());
     $this->assertNull($this->object->removeItem("test"));
     $this->assertFalse($this->object->hasItem("test"));
 }
開發者ID:rvilbrandt,項目名稱:gamebook,代碼行數:9,代碼來源:InventoryTest.php


注:本文中的Inventory::addItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。