本文整理匯總了PHP中Magento\Catalog\Api\ProductRepositoryInterface::method方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductRepositoryInterface::method方法的具體用法?PHP ProductRepositoryInterface::method怎麽用?PHP ProductRepositoryInterface::method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Api\ProductRepositoryInterface
的用法示例。
在下文中一共展示了ProductRepositoryInterface::method方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testItEnablesAnExistingProduct
public function testItEnablesAnExistingProduct()
{
$mockProduct = $this->getMockDisabledProduct('test');
$mockProduct->expects($this->once())->method('setStatus')->with(ProductStatus::STATUS_ENABLED);
$this->mockProductRepository->method('get')->willReturn($mockProduct);
$this->mockProductRepository->expects($this->once())->method('save');
$this->productStatusAdapter->enableProductWithSku('test');
}
示例2: testItReturnsTheProductStatusString
public function testItReturnsTheProductStatusString()
{
$this->mockProductRepository->method('get')->willReturnMap([['enabled_sku', false, null, false, $this->createMockEnabledProduct('enabled_sku')], ['disabled_sku', false, null, false, $this->createMockDisabledProduct('disabled_sku')]]);
$this->assertSame(ProductStatusAdapterInterface::ENABLED, $this->productStatusAdapter->getStatusBySku('enabled_sku'));
$this->assertSame(ProductStatusAdapterInterface::DISABLED, $this->productStatusAdapter->getStatusBySku('disabled_sku'));
}