/** * {@inheritdoc} */ public function getById($productId, $editMode = false, $storeId = null, $forceReload = false) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getById'); if (!$pluginInfo) { return parent::getById($productId, $editMode, $storeId, $forceReload); } else { return $this->___callPlugins('getById', func_get_args(), $pluginInfo); } }
public function testGetBySkuFromCacheInitializedInGetById() { $productId = 123; $productSku = 'product_123'; $this->productFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->productMock)); $this->productMock->expects($this->once())->method('load')->with($productId); $this->productMock->expects($this->once())->method('getId')->willReturn($productId); $this->productMock->expects($this->once())->method('getSku')->willReturn($productSku); $this->assertEquals($this->productMock, $this->model->getById($productId)); $this->assertEquals($this->productMock, $this->model->get($productSku)); }
/** * Load source model * * @return \Owebia\ShippingCore\Model\Wrapper\Product */ public function load() { $this->source = $this->productRepository->getById($this->entity_id); $this->cache->setData([]); return $this; }