本文整理汇总了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);
}
示例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");
}
}
示例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"));
}