/**
  * ViewPixel constructor.
  * @param Context $context
  * @param ArrayUtils $arrayUtils
  * @param array $data
  * @param SpringbotHelper $springbotHelper
  */
 public function __construct(Context $context, ArrayUtils $arrayUtils, array $data = [], SpringbotHelper $springbotHelper)
 {
     $this->springbotHelper = $springbotHelper;
     $this->scopeConfig = $context->getScopeConfig();
     $this->urlInterface = $context->getUrlBuilder();
     parent::__construct($context, $arrayUtils, $data);
 }
Beispiel #2
0
 /**
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \UOL\PagSeguro\Model\Direct\InstallmentsMethodFactory $installmentFactory
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, \UOL\PagSeguro\Model\Direct\InstallmentsMethodFactory $installmentFactory)
 {
     $this->_coreRegistry = $context->getRegistry();
     $this->_scopeConfig = $scopeConfigInterface;
     $this->_installmentFactory = $installmentFactory;
     parent::__construct($context);
 }
 protected function mockContext()
 {
     $this->context = $this->getMockBuilder('Magento\\Catalog\\Block\\Product\\Context')->disableOriginalConstructor()->getMock();
     $this->imageHelper = $this->getMockBuilder('Magento\\Catalog\\Helper\\Image')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->any())->method('getImageHelper')->willReturn($this->imageHelper);
     $this->registry = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->any())->method('getRegistry')->willReturn($this->registry);
 }
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, Registry $registry, array $data = [])
 {
     $this->_coreRegistry = $registry;
     $this->_productCollectionFactory = $productCollectionFactory;
     $this->_catalogConfig = $context->getCatalogConfig();
     $this->_catalogProductVisibility = $catalogProductVisibility;
     parent::__construct($context, $data);
 }
Beispiel #5
0
 protected function setUp()
 {
     $this->layout = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->getMockForAbstractClass();
     $this->productContext = $this->getMockBuilder('Magento\\Catalog\\Block\\Product\\Context')->disableOriginalConstructor()->getMock();
     $this->productContext->expects($this->any())->method('getLayout')->willReturn($this->layout);
     $this->httpContext = $this->getMockBuilder('Magento\\Framework\\App\\Http\\Context')->disableOriginalConstructor()->getMock();
     $this->block = new Sidebar($this->productContext, $this->httpContext);
 }
Beispiel #6
0
 /**
  * Set up mocks and tested class
  * Child class is used as the tested class is declared abstract
  */
 public function setUp()
 {
     $this->productContextMock = $this->getMock('Magento\\Catalog\\Block\\Product\\Context', ['getLayout'], [], '', false);
     $arrayUtilsMock = $this->getMock('Magento\\Framework\\Stdlib\\ArrayUtils', [], [], '', false);
     $this->layoutMock = $this->getMock('Magento\\Framework\\View\\Layout', ['getBlock'], [], '', false);
     $this->productContextMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->layoutMock));
     $this->block = new \Magento\Catalog\Block\Product\View\Type\Simple($this->productContextMock, $arrayUtilsMock);
 }
Beispiel #7
0
 /**
  * @param Context $context
  * @param array $data
  * @param Product $product
  * @param Category $category
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, Product $product, Category $category, array $data = [])
 {
     $this->Product = $product;
     $this->Category = $category;
     $this->reviewRenderer = $context->getReviewRenderer();
     $this->imageHelper = $context->getImageHelper();
     parent::__construct($context, $data);
 }
 /**
  * @param Context $context
  * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
  * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Reports\Model\ResourceModel\Report\Collection\Factory $resourceFactory, \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory, \Magento\Reports\Helper\Data $reportsData, array $data = [])
 {
     $this->_resourceFactory = $resourceFactory;
     $this->_collectionFactory = $collectionFactory;
     $this->_reportsData = $reportsData;
     $this->_imageHelper = $context->getImageHelper();
     $this->_cartHelper = $context->getCartHelper();
     parent::__construct($context, $data);
 }
 /**
  * @param Context $context
  * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory
  * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Framework\App\Http\Context $httpContext, array $data = [])
 {
     $this->_productCollectionFactory = $productCollectionFactory;
     $this->_catalogProductVisibility = $catalogProductVisibility;
     $this->httpContext = $httpContext;
     $this->_imageHelper = $context->getImageHelper();
     $this->_cartHelper = $context->getCartHelper();
     parent::__construct($context, $data);
 }
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\ObjectManagerFactory $objectManagerFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Session $catalogSession, \Magento\Checkout\Model\Session $checkoutSession, array $data = [])
 {
     $this->_cartHelper = $context->getCartHelper();
     $this->_objectManagerFactory = $objectManagerFactory;
     $this->categoryFactory = $categoryFactory;
     $this->_catalogSession = $catalogSession;
     $this->_checkoutSession = $checkoutSession;
     parent::__construct($context, $data);
 }
Beispiel #11
0
 /**
  * Set up mocks and tested class
  * Child class is used as the tested class is declared abstract
  */
 public function setUp()
 {
     $this->productContextMock = $this->getMock('Magento\\Catalog\\Block\\Product\\Context', ['getLayout', 'getStockRegistry'], [], '', false);
     $arrayUtilsMock = $this->getMock('Magento\\Framework\\Stdlib\\ArrayUtils', [], [], '', false);
     $this->layoutMock = $this->getMock('Magento\\Framework\\View\\Layout', ['getBlock'], [], '', false);
     $this->stockRegistryMock = $this->getMockForAbstractClass('Magento\\CatalogInventory\\Api\\StockRegistryInterface', [], '', false, true, true, ['getStockItem']);
     $this->productContextMock->expects($this->once())->method('getStockRegistry')->will($this->returnValue($this->stockRegistryMock));
     $this->productContextMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->layoutMock));
     $this->block = new \Magento\Catalog\Block\Product\View\Type\Simple($this->productContextMock, $arrayUtilsMock);
 }
Beispiel #12
0
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Framework\App\Http\Context $httpContext, \Emizentech\ShopByBrand\Model\BrandFactory $brandFactory, \Magento\Framework\View\Page\Config $pageConfig, array $data = [])
 {
     $this->_productCollectionFactory = $productCollectionFactory;
     $this->_catalogProductVisibility = $catalogProductVisibility;
     $this->httpContext = $httpContext;
     $this->_imageHelper = $context->getImageHelper();
     $this->_brandFactory = $brandFactory;
     $this->_cartHelper = $context->getCartHelper();
     $this->pageConfig = $pageConfig;
     parent::__construct($context, $data);
 }
Beispiel #13
0
 /**
  * Set up
  */
 protected function setUp()
 {
     $this->contextMock = $this->getMock('\\Magento\\Catalog\\Block\\Product\\Context', [], [], '', false);
     $this->arrayUtilsMock = $this->getMock('\\Magento\\Framework\\Stdlib\\ArrayUtils', [], [], '', false);
     $this->mediaHelperMock = $this->getMock('\\Magento\\ProductVideo\\Helper\\Media', [], [], '', false);
     $this->jsonEncoderMock = $this->getMock('\\Magento\\Framework\\Json\\EncoderInterface', [], [], '', false);
     $this->coreRegistry = $this->getMock('\\Magento\\Framework\\Registry', [], [], '', false);
     $this->contextMock->expects($this->once())->method('getRegistry')->willReturn($this->coreRegistry);
     $this->productModelMock = $this->getMock('\\Magento\\Catalog\\Model\\Product', [], [], '', false);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->gallery = $objectManager->getObject('\\Magento\\ProductVideo\\Block\\Product\\View\\Gallery', ['context' => $this->contextMock, 'arrayUtils' => $this->arrayUtilsMock, 'mediaHelper' => $this->mediaHelperMock, 'jsonEncoder' => $this->jsonEncoderMock]);
 }
Beispiel #14
0
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\ConfigurableProduct\Model\Product\Type\Configurable $configurable, \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable $catalogProductTypeConfigurable, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory, \Magento\Framework\App\ResourceConnection $resource, array $data = [])
 {
     $this->_collectionFactory = $collectionFactory;
     $this->_coreRegistry = $registry;
     $this->_imageHelper = $context->getImageHelper();
     $this->catalogProductVisibility = $catalogProductVisibility;
     $this->_productFactory = $productFactory;
     $this->_configurable = $configurable;
     $this->_productCollectionFactory = $productCollectionFactory;
     //for getting parent id of simple
     $this->_catalogProductTypeConfigurable = $catalogProductTypeConfigurable;
     $this->_resource = $resource;
     parent::__construct($context, $data);
 }
 /**
  * BxRecommendationBlock constructor.
  * @param \Magento\Catalog\Block\Product\Context $context
  * @param \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper
  * @param \Boxalino\Intelligence\Helper\Data $bxHelperData
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility
  * @param \Magento\Catalog\Model\ResourceModel\Product\Link\Product\CollectionFactory $factory
  * @param \Magento\Framework\App\Request\Http $request
  * @param \Psr\Log\LoggerInterface $logger
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper, \Boxalino\Intelligence\Helper\Data $bxHelperData, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Catalog\Model\ResourceModel\Product\Link\Product\CollectionFactory $factory, \Magento\Framework\App\Request\Http $request, \Psr\Log\LoggerInterface $logger, array $data)
 {
     $this->_logger = $logger;
     $this->bxHelperData = $bxHelperData;
     $this->_catalogProductVisibility = $catalogProductVisibility;
     $this->factory = $factory;
     $this->registry = $context->getRegistry();
     $this->p13nHelper = $p13nHelper;
     $this->config = $context->getScopeConfig();
     $this->_checkoutSession = $checkoutSession;
     $this->_data = $data;
     $this->othersWidgetConfig = $this->config->getValue('bxRecommendations/others', $this->scopeStore);
     parent::__construct($context, $data);
 }
 public function setUp()
 {
     $this->context = $this->getMock('\\Magento\\Catalog\\Block\\Product\\Context', [], [], '', false);
     $this->arrayUtils = $this->getMock('\\Magento\\Framework\\Stdlib\\ArrayUtils', [], [], '', false);
     $this->jsonEncoder = $this->getMock('\\Magento\\Framework\\Json\\EncoderInterface', [], [], '', false);
     $this->helper = $this->getMock('\\Magento\\ConfigurableProduct\\Helper\\Data', [], [], '', false);
     $this->swatchHelper = $this->getMock('\\Magento\\Swatches\\Helper\\Data', [], [], '', false);
     $this->swatchMediaHelper = $this->getMock('\\Magento\\Swatches\\Helper\\Media', [], [], '', false);
     $this->catalogProduct = $this->getMock('\\Magento\\Catalog\\Helper\\Product', [], [], '', false);
     $this->currentCustomer = $this->getMock('\\Magento\\Customer\\Helper\\Session\\CurrentCustomer', [], [], '', false);
     $this->priceCurrency = $this->getMock('\\Magento\\Framework\\Pricing\\PriceCurrencyInterface', [], [], '', false);
     $this->product = $this->getMock('\\Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->typeInstance = $this->getMock('\\Magento\\Catalog\\Model\\Product\\Type\\AbstractType', [], [], '', false);
     $this->scopeConfig = $this->getMock('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface', [], [], '', false);
     $this->imageHelper = $this->getMock('\\Magento\\Catalog\\Helper\\Image', [], [], '', false);
     $this->urlBuilder = $this->getMock('\\Magento\\Framework\\UrlInterface');
     $this->context->expects($this->any())->method('getScopeConfig')->willReturn($this->scopeConfig);
     $this->context->expects($this->any())->method('getImageHelper')->willReturn($this->imageHelper);
     $this->context->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilder);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->configurable = $objectManager->getObject('\\Magento\\Swatches\\Block\\Product\\Renderer\\Configurable', ['context' => $this->context, 'arrayUtils' => $this->arrayUtils, 'jsonEncoder' => $this->jsonEncoder, 'helper' => $this->helper, 'swatchHelper' => $this->swatchHelper, 'swatchMediaHelper' => $this->swatchMediaHelper, 'catalogProduct' => $this->catalogProduct, 'currentCustomer' => $this->currentCustomer, 'priceCurrency' => $this->priceCurrency, 'data' => []]);
 }
 /**
  * @param Context $context
  * @param array $data
  */
 public function __construct(\Magento\Catalog\Block\Product\Context $context, array $data = [])
 {
     $this->_imageHelper = $context->getImageHelper();
     $this->imageBuilder = $context->getImageBuilder();
     $this->_compareProduct = $context->getCompareProduct();
     $this->_wishlistHelper = $context->getWishlistHelper();
     $this->_cartHelper = $context->getCartHelper();
     $this->_catalogConfig = $context->getCatalogConfig();
     $this->_coreRegistry = $context->getRegistry();
     $this->_taxData = $context->getTaxData();
     $this->_mathRandom = $context->getMathRandom();
     $this->reviewRenderer = $context->getReviewRenderer();
     $this->stockRegistry = $context->getStockRegistry();
     parent::__construct($context, $data);
 }
 /**
  * @param Context $context
  */
 public function __construct(Context $context)
 {
     $this->registry = $context->getRegistry();
     parent::__construct($context);
 }
 /**
  * Run test getStockRegistry method
  *
  * @return void
  */
 public function testGetStockRegistry()
 {
     $this->assertEquals($this->stockRegistryMock, $this->context->getStockRegistry());
 }
 public function testGetImageBuilder()
 {
     $this->assertInstanceOf('Magento\\Catalog\\Block\\Product\\ImageBuilder', $this->context->getImageBuilder());
 }