/** * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedMessage For current customerGroupId = '10' any group price exist'. */ public function testRemoveGroupPriceForNonExistingCustomerGroup() { $this->productMock->expects($this->once())->method('getData')->with('group_price')->will($this->returnValue($this->prices)); $this->productMock->expects($this->never())->method('setData'); $this->productRepositoryMock->expects($this->never())->method('save'); $this->priceModifier->removeGroupPrice($this->productMock, 10, 1); }
/** * {@inheritdoc} */ public function delete($productSku, $customerGroupId) { $product = $this->productRepository->get($productSku, true); if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { $websiteId = 0; } else { $websiteId = $this->storeManager->getWebsite()->getId(); } $this->priceModifier->removeGroupPrice($product, $customerGroupId, $websiteId); return true; }