/**
  * @covers \Magento\Checkout\Block\Cart\Item\Renderer::getProductPriceHtml
  * @covers \Magento\Checkout\Block\Cart\Item\Renderer::getPriceRender
  */
 public function testGetProductPriceHtml()
 {
     $priceHtml = 'some price html';
     $product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->getMock();
     $priceRender = $this->getMockBuilder('Magento\\Framework\\Pricing\\Render')->disableOriginalConstructor()->getMock();
     $this->layout->expects($this->atLeastOnce())->method('getBlock')->with('product.price.render.default')->will($this->returnValue($priceRender));
     $priceRender->expects($this->once())->method('render')->with(\Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, $product, ['include_container' => true, 'display_minimal_price' => true, 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST])->will($this->returnValue($priceHtml));
     $this->assertEquals($priceHtml, $this->_renderer->getProductPriceHtml($product));
 }
Beispiel #2
0
 /**
  * Return identifiers for produced content
  *
  * @return array
  */
 public function getIdentities()
 {
     $identities = parent::getIdentities();
     if ($this->getItem()) {
         $identities = array_merge($identities, $this->getGroupedProduct()->getIdentities());
     }
     return $identities;
 }
Beispiel #3
0
 public function testGetActionsWithNoBlock()
 {
     $this->layout->expects($this->once())->method('getChildName')->with($this->_renderer->getNameInLayout(), 'actions')->willReturn(false);
     /**
      * @var Item|\PHPUnit_Framework_MockObject_MockObject $itemMock
      */
     $itemMock = $this->getMockBuilder('Magento\\Quote\\Model\\Quote\\Item')->disableOriginalConstructor()->getMock();
     $this->assertEquals('', $this->_renderer->getActions($itemMock));
 }
 public function testGetImage()
 {
     $imageId = 'test_image_id';
     $attributes = [];
     $productMock = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->getMock();
     $imageMock = $this->getMockBuilder('Magento\\Catalog\\Block\\Product\\Image')->disableOriginalConstructor()->getMock();
     $this->imageBuilder->expects($this->once())->method('setProduct')->with($productMock)->willReturnSelf();
     $this->imageBuilder->expects($this->once())->method('setImageId')->with($imageId)->willReturnSelf();
     $this->imageBuilder->expects($this->once())->method('setAttributes')->with($attributes)->willReturnSelf();
     $this->imageBuilder->expects($this->once())->method('create')->willReturn($imageMock);
     $this->assertInstanceOf('Magento\\Catalog\\Block\\Product\\Image', $this->_renderer->getImage($productMock, $imageId, $attributes));
 }
Beispiel #5
0
 public function testThumbnail()
 {
     $size = $this->_block->getThumbnailSize();
     $sidebarSize = $this->_block->getThumbnailSidebarSize();
     $this->assertGreaterThan(1, $size);
     $this->assertGreaterThan(1, $sidebarSize);
     $this->assertContains('/' . $size, $this->_block->getProductThumbnailUrl());
     $this->assertContains('/' . $sidebarSize, $this->_block->getProductThumbnailSidebarUrl());
     $this->assertStringEndsWith('magento_image.jpg', $this->_block->getProductThumbnailUrl());
     $this->assertStringEndsWith('magento_image.jpg', $this->_block->getProductThumbnailSidebarUrl());
 }
Beispiel #6
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Product\Configuration $productConfig
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Core\Helper\Url $urlHelper
  * @param \Magento\Framework\Message\ManagerInterface $messageManager
  * @param \Magento\Downloadable\Helper\Catalog\Product\Configuration $dwnCtlgProdConfig
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Product\Configuration $productConfig, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Core\Helper\Url $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\Downloadable\Helper\Catalog\Product\Configuration $dwnCtlgProdConfig, array $data = array())
 {
     $this->_downloadProdConfig = $dwnCtlgProdConfig;
     parent::__construct($context, $productConfig, $checkoutSession, $imageHelper, $urlHelper, $messageManager, $data);
 }
Beispiel #7
0
 /**
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_configurationHelper = $this->_bundleProductConfiguration;
 }
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Product\Configuration $productConfig
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder
  * @param \Magento\Framework\Url\Helper\Data $urlHelper
  * @param \Magento\Framework\Message\ManagerInterface $messageManager
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Framework\Module\Manager $moduleManager
  * @param InterpretationStrategyInterface $messageInterpretationStrategy
  * @param \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Product\Configuration $productConfig, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder, \Magento\Framework\Url\Helper\Data $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, PriceCurrencyInterface $priceCurrency, \Magento\Framework\Module\Manager $moduleManager, InterpretationStrategyInterface $messageInterpretationStrategy, \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration, array $data = [])
 {
     $this->_downloadableProductConfiguration = $downloadableProductConfiguration;
     parent::__construct($context, $productConfig, $checkoutSession, $imageBuilder, $urlHelper, $messageManager, $priceCurrency, $moduleManager, $messageInterpretationStrategy, $data);
 }
Beispiel #9
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Product\Configuration $productConfig
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Framework\Url\Helper\Data $urlHelper
  * @param \Magento\Framework\Message\ManagerInterface $messageManager
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Framework\Module\Manager $moduleManager
  * @param Configuration $bundleProductConfiguration
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Product\Configuration $productConfig, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Framework\Url\Helper\Data $urlHelper, \Magento\Framework\Message\ManagerInterface $messageManager, PriceCurrencyInterface $priceCurrency, \Magento\Framework\Module\Manager $moduleManager, Configuration $bundleProductConfiguration, array $data = [])
 {
     $this->_bundleProductConfiguration = $bundleProductConfiguration;
     parent::__construct($context, $productConfig, $checkoutSession, $imageHelper, $urlHelper, $messageManager, $priceCurrency, $moduleManager, $data);
     $this->_isScopePrivate = true;
 }
 public function testGetConfigureUrl()
 {
     $testString = 'checkout/cart/configure/id/' . $this->_block->getItem()->getId() . '/product_id/1/';
     $this->assertStringEndsWith($testString, $this->_block->getConfigureUrl());
 }