예제 #1
0
 public function testGetIdentities()
 {
     $productTags = ['catalog_product_1'];
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false);
     $category = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTags));
     $category->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->registryMock->expects($this->any())->method('registry')->will($this->returnValueMap([['product', $product], ['current_category', $category]]));
     $this->assertEquals(['catalog_product_1', 'catalog_category_product_1'], $this->view->getIdentities());
 }
예제 #2
0
 /**
  * @param \Magento\Catalog\Block\Product\View $block
  * @param array $validators
  * @return array
  */
 public function afterGetQuantityValidators(\Magento\Catalog\Block\Product\View $block, array $validators)
 {
     $stockItem = $this->stockRegistry->getStockItem($block->getProduct()->getId(), $block->getProduct()->getStore()->getWebsiteId());
     $params = [];
     $params['minAllowed'] = max((double) $stockItem->getQtyMinAllowed(), 1);
     if ($stockItem->getQtyMaxAllowed()) {
         $params['maxAllowed'] = $stockItem->getQtyMaxAllowed();
     }
     if ($stockItem->getQtyIncrements() > 0) {
         $params['qtyIncrements'] = (double) $stockItem->getQtyIncrements();
     }
     $validators['validate-item-quantity'] = $params;
     return $validators;
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function getImage($product, $imageId, $attributes = array())
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage');
     if (!$pluginInfo) {
         return parent::getImage($product, $imageId, $attributes);
     } else {
         return $this->___callPlugins('getImage', func_get_args(), $pluginInfo);
     }
 }
예제 #4
0
 public function testStartBundleCustomization()
 {
     $this->markTestSkipped("Functionality not implemented in Magento 1.x. Implemented in Magento 2");
     $this->assertFalse($this->_block->startBundleCustomization());
 }
예제 #5
0
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $this->getProduct()->setShortDescription(null);
     return parent::_toHtml();
 }
예제 #6
0
 /**
  * Constructor.
  *
  * @param Context $context the context.
  * @param UrlEncoder $urlEncoder the  url encoder.
  * @param JsonEncoder $jsonEncoder the json encoder.
  * @param StringUtils $string the string lib.
  * @param \Magento\Catalog\Helper\Product $productHelper the product helper.
  * @param ConfigInterface $productTypeConfig the product type config.
  * @param FormatInterface $localeFormat the locale format.
  * @param Session $customerSession the user session.
  * @param ProductRepositoryInterface $productRepository th product repository.
  * @param PriceCurrencyInterface $priceCurrency the price currency.
  * @param ProductBuilder $productBuilder the product meta model builder.
  * @param CategoryBuilder $categoryBuilder the category meta model builder.
  * @param Data $dataHelper the data helper.
  * @param Format $formatHelper the format helper.
  * @param array $data optional data.
  */
 public function __construct(Context $context, UrlEncoder $urlEncoder, JsonEncoder $jsonEncoder, StringUtils $string, \Magento\Catalog\Helper\Product $productHelper, ConfigInterface $productTypeConfig, FormatInterface $localeFormat, Session $customerSession, ProductRepositoryInterface $productRepository, PriceCurrencyInterface $priceCurrency, ProductBuilder $productBuilder, CategoryBuilder $categoryBuilder, Data $dataHelper, Format $formatHelper, array $data = [])
 {
     parent::__construct($context, $urlEncoder, $jsonEncoder, $string, $productHelper, $productTypeConfig, $localeFormat, $customerSession, $productRepository, $priceCurrency, $data);
     $this->_productBuilder = $productBuilder;
     $this->_categoryBuilder = $categoryBuilder;
     $this->_dataHelper = $dataHelper;
     $this->_formatHelper = $formatHelper;
 }
예제 #7
0
 /**
  * {@inheritdoc}
  */
 public function offsetGet($offset)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet');
     if (!$pluginInfo) {
         return parent::offsetGet($offset);
     } else {
         return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo);
     }
 }