当前位置: 首页>>代码示例>>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;未经允许,请勿转载。