本文整理汇总了PHP中Warehouse::processWarehouses方法的典型用法代码示例。如果您正苦于以下问题:PHP Warehouse::processWarehouses方法的具体用法?PHP Warehouse::processWarehouses怎么用?PHP Warehouse::processWarehouses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Warehouse
的用法示例。
在下文中一共展示了Warehouse::processWarehouses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_processLot
public function test_processLot()
{
/** === Test Data === */
$PRODUCT_ID = 32;
/* this warehouse exists in Mage */
$WRHS1_ID_ODOO = 401;
$WRHS1_ID_MAGE = 104;
$WRHS1_PV = 545;
$WRHS1_PRICE = 12.23;
// lots
$WRHS1_LOT1_QTY = 10;
$WRHS1_LOTS = [1];
$WRHS_1 = new \Praxigento\Odoo\Data\Odoo\Inventory\Product\Warehouse();
$WRHS_1->setIdOdoo($WRHS1_ID_ODOO);
$WRHS_1->setPvWarehouse($WRHS1_PV);
$WRHS_1->setPriceWarehouse($WRHS1_PRICE);
$WRHS_1->setLots($WRHS1_LOTS);
/* this warehouse is missed in Mage */
$WRHS2_ID_ODOO = 402;
$WRHS2_PV = 546;
$WRHS2_PRICE = 21.23;
$WRHS2_LOTS = [];
$WRHS_2 = new \Praxigento\Odoo\Data\Odoo\Inventory\Product\Warehouse();
$WRHS_2->setIdOdoo($WRHS2_ID_ODOO);
$WRHS_2->setPvWarehouse($WRHS2_PV);
$WRHS_2->setPriceWarehouse($WRHS2_PRICE);
$WRHS_2->setLots($WRHS2_LOTS);
/* compose warehouses list */
$WAREHOUSES = [$WRHS_1, $WRHS_2];
$STOCK_ITEM_ID_1 = 501;
/** === Setup Mocks === */
//
// $stockItems = $this->_getStockItems($productIdMage);
//
// $crit = $this->_manObj->create(StockItemCriteriaInterface::class);
$mCrit = $this->_mock(\Magento\CatalogInventory\Api\StockItemCriteriaInterface::class);
$this->mManObj->shouldReceive('create')->once()->andReturn($mCrit);
// $crit->setProductsFilter($prodId);
$mCrit->shouldReceive('setProductsFilter')->once();
// $list = $this->_mageRepoStockItem->getList($crit);
$mList = $this->_mock(\Magento\CatalogInventory\Api\Data\StockItemCollectionInterface::class);
$this->mMageRepoStockItem->shouldReceive('getList')->once()->andReturn($mList);
// $result = $list->getItems();
$mStockItem1 = $this->_mock(\Magento\CatalogInventory\Api\Data\StockItemInterface::class);
$mStockItems = [$STOCK_ITEM_ID_1 => $mStockItem1];
$mList->shouldReceive('getItems')->once()->andReturn($mStockItems);
//
// $mapItemsByStock = $this->_mapStockIds($stockItems);
//
// foreach ($stockItems as $stockItemId => $stockItem) {}
// $stockId = $stockItem->getStockId();
$mStockItem1->shouldReceive('getStockId')->once()->andReturn($WRHS1_ID_MAGE);
// $stockIdMage = $this->_repoRegistry->getWarehouseMageIdByOdooId($stockIdOdoo);
$this->mRepoRegistry->shouldReceive('getWarehouseMageIdByOdooId')->once()->with($WRHS1_ID_ODOO)->andReturn($WRHS1_ID_MAGE);
//
// First loop (wrhs exists)
// $this->_subDataHandler->updateWarehouseData($stockItemIdMage, $priceWarehouse, $pvWarehouse);
$this->mSubDataHandler->shouldReceive('updateWarehouseData')->once();
// $this->_subDataHandler->processLots($lots, $stockItem);
$this->mSubDataHandler->shouldReceive('processLots')->once();
//
// Second loop (wrhs does not exist)
//
// $stockIdMage = $this->_repoRegistry->getWarehouseMageIdByOdooId($stockIdOdoo);
$this->mRepoRegistry->shouldReceive('getWarehouseMageIdByOdooId')->once()->with($WRHS2_ID_ODOO)->andReturn(null);
// $stockItem = $this->_subDataHandler->createWarehouseData($productIdMage, $stockIdMage, $priceWarehouse, $pvWarehouse);
$this->mSubDataHandler->shouldReceive('createWarehouseData')->once();
// $this->_subDataHandler->processLots($lots, $stockItem);
$this->mSubDataHandler->shouldReceive('processLots')->once();
/** === Call and asserts === */
$this->obj->processWarehouses($PRODUCT_ID, $WAREHOUSES);
}