/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository * @param \Magento\GiftMessage\Api\ItemRepositoryInterface $itemRepository * @param \Magento\Checkout\Model\Session $checkoutSession */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository, \Magento\GiftMessage\Api\ItemRepositoryInterface $itemRepository, \Magento\Checkout\Model\Session $checkoutSession) { $this->scopeConfiguration = $context->getScopeConfig(); $this->cartRepository = $cartRepository; $this->itemRepository = $itemRepository; $this->checkoutSession = $checkoutSession; }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param \Magento\Framework\App\ProductMetadataInterface $productMetadata */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\App\ProductMetadataInterface $productMetadata) { $this->_localeResolver = $localeResolver; $this->_productMetadata = $productMetadata; $this->_request = $context->getRequest(); parent::__construct($context); }
/** * Constructor * gi * @param ObjectManagerInterface $objectManager * @param Config $config * @param Context $context */ public function __construct(ObjectManagerInterface $objectManager, Config $config, Context $context) { $this->objectManager = $objectManager; $this->moduleManager = $context->getModuleManager(); $this->config = $config; return parent::__construct($context); }
/** * @param Context $context * @param ObjectManagerInterface $objectManager * @param StdlibString $string * @param ScopeConfigInterface $scopeConfig */ public function __construct(Context $context, ObjectManagerInterface $objectManager, StdlibString $string) { $this->request = $context->getRequest(); $this->objectManager = $objectManager; $this->string = $string; $this->scopeConfig = $context->getScopeConfig(); }
/** * Create mock objects */ protected function setUp() { $this->scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->getMock(); $this->contextMock = $this->getMock('Magento\\Framework\\App\\Helper\\Context', [], [], '', false); $this->contextMock->expects($this->any())->method('getScopeConfig')->willReturn($this->scopeConfigMock); $this->helper = new \Magento\ProductVideo\Helper\Media($this->contextMock); }
/** * Dispay type. * * @return mixed|string grid:list */ public function getDisplayType() { $mode = $this->context->getRequest()->getActionName(); $type = ''; switch ($mode) { case 'related': $type = $this->getRelatedProductsType(); break; case 'upsell': $type = $this->getUpsellProductsType(); break; case 'crosssell': $type = $this->getCrosssellProductsType(); break; case 'bestsellers': $type = $this->getBestSellerProductsType(); break; case 'mostviewed': $type = $this->getMostViewedProductsType(); break; case 'recentlyviewed': $type = $this->getRecentlyviewedProductsType(); break; case 'push': $type = $this->getProductpushProductsType(); } return $type; }
/** * Constructor * * @param ImageFactory $imageFactory * @param Context $context * @param AssetRepository $assetRepo */ public function __construct(ImageFactory $imageFactory, Context $context, AssetRepository $assetRepo) { $this->imageFactory = $imageFactory; $this->context = $context; $this->scopeConfig = $context->getScopeConfig(); $this->assetRepo = $assetRepo; parent::__construct($context); }
/** * Construct * * @param Context $context * @param StringUtils $string * @param Escaper $escaper * @param StoreManagerInterface $storeManager */ public function __construct(Context $context, StringUtils $string, Escaper $escaper, StoreManagerInterface $storeManager) { $this->string = $string; $this->scopeConfig = $context->getScopeConfig(); $this->escaper = $escaper; $this->storeManager = $storeManager; parent::__construct($context); }
/** * @param Context $context * @param ObjectManagerInterface $objectManager * @param StdlibString $string * @param Data|null $queryHelper */ public function __construct(Context $context, ObjectManagerInterface $objectManager, StdlibString $string, Data $queryHelper = null) { $this->request = $context->getRequest(); $this->objectManager = $objectManager; $this->string = $string; $this->scopeConfig = $context->getScopeConfig(); $this->queryHelper = $queryHelper === null ? $this->objectManager->get(Data::class) : $queryHelper; }
protected function setUp() { $this->objectManagerHelper = new ObjectManagerHelper($this); $this->context = $this->getMockBuilder('\\Magento\\Framework\\App\\Helper\\Context')->disableOriginalConstructor()->getMock(); $this->scopeConfig = $this->getMock('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface'); $this->productConfig = $this->getMockBuilder('\\Magento\\Catalog\\Helper\\Product\\Configuration')->disableOriginalConstructor()->getMock(); $this->context->expects($this->once())->method('getScopeConfig')->willReturn($this->scopeConfig); $this->helper = $this->objectManagerHelper->getObject('Magento\\Downloadable\\Helper\\Catalog\\Product\\Configuration', ['context' => $this->context, 'productConfig' => $this->productConfig]); }
protected function setUp() { $this->urlBuilderMock = $this->getMock('Magento\\Framework\\UrlInterface', [], [], '', false); $this->moduleManagerMock = $this->getMock('Magento\\Framework\\Module\\Manager', [], [], '', false); $this->contextMock = $this->getMock('Magento\\Framework\\App\\Helper\\Context', [], [], '', false); $this->contextMock->expects($this->once())->method('getModuleManager')->will($this->returnValue($this->moduleManagerMock)); $this->contextMock->expects($this->once())->method('getUrlBuilder')->will($this->returnValue($this->urlBuilderMock)); $this->helper = $this->getMockForAbstractClass('Magento\\Framework\\App\\Helper\\AbstractHelper', ['context' => $this->contextMock]); }
/** * Constructor * * @param Context $context * @param QueryFactory $queryFactory * @param UrlFactory $urlFactory * @param SuggestFactory $suggestFactory * @param TextHelper $textHelper */ public function __construct(Context $context, QueryFactory $queryFactory, UrlFactory $urlFactory, SuggestFactory $suggestFactory, TextHelper $textHelper) { $this->request = $context->getRequest(); $this->query = $queryFactory->get(); $this->text = $textHelper; $this->urlFactory = $urlFactory; $this->suggestFactory = $suggestFactory; parent::__construct($context); }
/** * {@inheritdoc} * * @param UrlRewriteFactory $urlRewriteFactory * @param UrlRewriteCollectionFactory $urlRewriteCollectionFactory * @param FilterManager $filter * @param Context $context */ public function __construct(UrlRewriteFactory $urlRewriteFactory, UrlRewriteCollectionFactory $urlRewriteCollectionFactory, FilterManager $filter, Context $context) { $this->urlRewriteFactory = $urlRewriteFactory; $this->urlRewriteCollectionFactory = $urlRewriteCollectionFactory; $this->filter = $filter; $this->urlManager = $context->getUrlBuilder(); $this->scopeConfig = $context->getScopeConfig(); parent::__construct($context); }
/** * Construct * * @param Context $context * @param String $string * @param QueryFactory $queryFactory * @param Escaper $escaper * @param StoreManagerInterface $storeManager */ public function __construct(Context $context, string $string, QueryFactory $queryFactory, Escaper $escaper, StoreManagerInterface $storeManager) { $this->string = $string; $this->_scopeConfig = $context->getScopeConfig(); $this->_queryFactory = $queryFactory; $this->_escaper = $escaper; $this->_storeManager = $storeManager; parent::__construct($context); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Ebizmarts\MageMonkey\Model\Logger\Logger $logger * @param \Magento\Customer\Model\GroupRegistry $groupRegistry */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Ebizmarts\MageMonkey\Model\Logger\Logger $logger, \Magento\Customer\Model\GroupRegistry $groupRegistry, \Magento\Framework\App\State $state) { $this->_storeManager = $storeManager; $this->_mlogger = $logger; $this->_groupRegistry = $groupRegistry; $this->_scopeConfig = $context->getScopeConfig(); $this->_request = $context->getRequest(); $this->_state = $state; parent::__construct($context); }
public function setUp() { $this->context = $this->getMockBuilder('Magento\\Framework\\App\\Helper\\Context')->disableOriginalConstructor()->getMock(); $this->request = $this->getMock('Magento\\Framework\\App\\RequestInterface'); $this->context->expects(static::once())->method('getRequest')->willReturn($this->request); $this->directoryHelperMock = $this->getMockBuilder('Magento\\Directory\\Helper\\Data')->disableOriginalConstructor()->getMock(); $this->backendConfig = $this->getMockBuilder('Magento\\Config\\Model\\Config')->disableOriginalConstructor()->getMock(); $this->scopeDefiner = $this->getMockBuilder('Magento\\Config\\Model\\Config\\ScopeDefiner')->disableOriginalConstructor()->getMock(); $this->helper = new Backend($this->context, $this->directoryHelperMock, $this->backendConfig, $this->scopeDefiner); }
/** * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Store\Model\StoreManagerInterface $storeManager, * @param \EMerchantPay\Genesis\Model\ConfigFactory $configFactory, * @param \Magento\Framework\Locale\ResolverInterface $localeResolver */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\App\Helper\Context $context, \Magento\Payment\Helper\Data $paymentData, \Magento\Store\Model\StoreManagerInterface $storeManager, \EMerchantPay\Genesis\Model\ConfigFactory $configFactory, \Magento\Framework\Locale\ResolverInterface $localeResolver) { $this->_objectManager = $objectManager; $this->_paymentData = $paymentData; $this->_storeManager = $storeManager; $this->_configFactory = $configFactory; $this->_localeResolver = $localeResolver; $this->_scopeConfig = $context->getScopeConfig(); parent::__construct($context); }
protected function _initMock() { $scopeConfig = $this->_getConfigStub(); $this->_request = $this->getMock('\\Magento\\Framework\\App\\Request\\Http', ['getCookie'], [], '', false, false); $this->_context = $this->getMock('Magento\\Framework\\App\\Helper\\Context', ['getRequest', 'getScopeConfig'], [], '', false, false); $this->_context->expects($this->once())->method('getRequest')->will($this->returnValue($this->_request)); $this->_context->expects($this->once())->method('getScopeConfig')->will($this->returnValue($scopeConfig)); $this->_object = new \Magento\Cookie\Helper\Cookie($this->_context, $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false, false), ['current_store' => $this->_getStoreStub(), 'website' => $this->_getWebsiteStub()]); return $this; }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\App\Config\BaseFactory $configFactory * @param array $methodCodes */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\BaseFactory $configFactory, array $methodCodes) { $this->_logger = $context->getLogger(); $pre = __METHOD__ . " : "; $this->_logger->debug($pre . 'bof, methodCodes is : ', $methodCodes); $this->_paymentData = $paymentData; $this->methodCodes = $methodCodes; $this->configFactory = $configFactory; parent::__construct($context); $this->_logger->debug($pre . 'eof'); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\SalesRule\Model\Coupon $coupon * @param \Magento\SalesRule\Model\Rule $rule * @param \Ebizmarts\Mandrill\Model\Mailsent $mailsent * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime * @param \Ebizmarts\Mandrill\Model\Unsubscribe $unsubscribe */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\SalesRule\Model\Coupon $coupon, \Magento\SalesRule\Model\Rule $rule, \Ebizmarts\Mandrill\Model\Mailsent $mailsent, \Magento\Framework\Stdlib\DateTime\DateTime $dateTime, \Ebizmarts\Mandrill\Model\Unsubscribe $unsubscribe) { $this->_logger = $context->getLogger(); $this->_coupon = $coupon; $this->_rule = $rule; $this->_mailsent = $mailsent; $this->_dateTime = $dateTime; $this->_unsubscribe = $unsubscribe; $this->_subscribed = array(); parent::__construct($context); }
public function setUp() { $this->_stringMock = $this->getMock('Magento\\Framework\\Stdlib\\String'); $this->_queryFactoryMock = $this->getMock('Magento\\Search\\Model\\QueryFactory', [], [], '', false); $this->_scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface'); $this->_escaperMock = $this->getMock('Magento\\Framework\\Escaper'); $this->_storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface'); $this->_contextMock = $this->getMock('Magento\\Framework\\App\\Helper\\Context', [], [], '', false); $this->_contextMock->expects($this->any())->method('getScopeConfig')->willReturn($this->_scopeConfigMock); $this->_model = new \Magento\CatalogSearch\Helper\Data($this->_contextMock, $this->_stringMock, $this->_queryFactoryMock, $this->_escaperMock, $this->_storeManagerMock); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository * @param \Magento\GiftMessage\Api\ItemRepositoryInterface $itemRepository * @param \Magento\Checkout\Model\Session $checkoutSession * @param HttpContext $httpContext * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param LocaleFormat $localeFormat * @param FormKey $formKey */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository, \Magento\GiftMessage\Api\ItemRepositoryInterface $itemRepository, \Magento\Checkout\Model\Session $checkoutSession, HttpContext $httpContext, \Magento\Store\Model\StoreManagerInterface $storeManager, LocaleFormat $localeFormat, FormKey $formKey) { $this->scopeConfiguration = $context->getScopeConfig(); $this->cartRepository = $cartRepository; $this->itemRepository = $itemRepository; $this->checkoutSession = $checkoutSession; $this->httpContext = $httpContext; $this->storeManager = $storeManager; $this->localeFormat = $localeFormat; $this->formKey = $formKey; }
/** * @param \Magento\Framework\App\Helper\Context $context, * @param \Magento\Framework\Code\Minifier\Adapter\Css\CSSmin $cssMin, * @param \Magento\Framework\Code\Minifier\Adapter\Js\JShrink $jsMin, * @param \Magento\Store\Model\StoreManager $stores, * @param \Magento\Framework\View\Asset\Repository $assetRepo, * @param \Magento\Framework\Filesystem\DirectoryList $dir, * @param \Magento\Framework\Filesystem $filesystem, * @param \Magento\Framework\App\ResourceConnection $resource */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\Code\Minifier\Adapter\Css\CSSmin $cssMin, \Magento\Framework\Code\Minifier\Adapter\Js\JShrink $jsMin, \Magento\Store\Model\StoreManager $stores, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\Filesystem\DirectoryList $dir, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\App\ResourceConnection $resource) { $this->_urlBuilder = $context->getUrlBuilder(); $this->_cssMin = $cssMin; $this->_jsMin = $jsMin; $this->_stores = $stores; $this->_dir = $dir; $this->_assetRepo = $assetRepo; $this->_resource = $resource; $this->_log = $filesystem->getDirectoryWrite($dir::ROOT); parent::__construct($context); }
public function setUp() { $this->stringMock = $this->getMock('Magento\\Framework\\Stdlib\\StringUtils'); $this->scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface'); $this->escaperMock = $this->getMock('Magento\\Framework\\Escaper'); $this->storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface'); $this->requestMock = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->contextMock = $this->getMock('Magento\\Framework\\App\\Helper\\Context', [], [], '', false); $this->contextMock->expects($this->any())->method('getScopeConfig')->willReturn($this->scopeConfigMock); $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock); $this->model = new \Magento\Search\Helper\Data($this->contextMock, $this->stringMock, $this->escaperMock, $this->storeManagerMock); }
public function __construct(Api $api, Order\Helper $orderHelper, Config $apiConfig, \Riskified\Decider\Logger\Merchant $logger, \Magento\Framework\App\Helper\Context $context, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Magento\Framework\Message\ManagerInterface $messageManager) { $this->_api = $api; $this->_orderHelper = $orderHelper; $this->_apiConfig = $apiConfig; $this->_context = $context; $this->_eventManager = $context->getEventManager(); $this->_backendAuthSession = $backendAuthSession; $this->_messageManager = $messageManager; $this->logger = $logger; $this->_api->initSdk(); }
protected function setUp() { $this->requestMock = $this->getMockBuilder('\\Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->contextMock = $this->getMockBuilder('Magento\\Framework\\App\\Helper\\Context')->setMethods(['getRequest'])->disableOriginalConstructor()->getMock(); $this->contextMock->expects($this->once())->method('getRequest')->will($this->returnValue($this->requestMock)); $this->objectManagerMock = $this->getMockBuilder('Magento\\Framework\\ObjectManagerInterface')->setMethods([])->getMock(); $this->stringMock = $this->getMockBuilder('Magento\\Framework\\Stdlib\\String')->setMethods(['cleanString', 'substr'])->getMock(); $this->stringMock->expects($this->any())->method('cleanString')->will($this->returnArgument(0)); $this->scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->setMethods([])->getMock(); $this->queryMock = $this->getMockBuilder('\\Magento\\Search\\Model\\Query')->disableOriginalConstructor()->setMethods(['setIsQueryTextExceeded', 'getId', 'setQueryText', 'loadByQuery'])->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->queryFactory = $this->objectManagerHelper->getObject('Magento\\Search\\Model\\QueryFactory', ['context' => $this->contextMock, 'objectManager' => $this->objectManagerMock, 'string' => $this->stringMock, 'scopeConfig' => $this->scopeConfigMock]); }
protected function setUp() { $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $className = 'Magento\\Customer\\Helper\\Address'; $arguments = $objectManagerHelper->getConstructArguments($className); /** @var \Magento\Framework\App\Helper\Context $context */ $this->context = $arguments['context']; $this->blockFactory = $arguments['blockFactory']; $this->storeManager = $arguments['storeManager']; $this->scopeConfig = $this->context->getScopeConfig(); $this->customerMetadataService = $arguments['customerMetadataService']; $this->addressConfig = $arguments['addressConfig']; $this->addressMetadataService = $arguments['addressMetadataService']; $this->helper = $objectManagerHelper->getObject($className, $arguments); }
public function __construct(Api $api, Order\Helper $orderHelper, Config $apiConfig, Order\Log $logger, \Magento\Framework\App\Helper\Context $context, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\Sales\Model\Order $orderFactory, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Riskified\Decider\Model\QueueFactory $queueFactory, \Magento\Framework\Session\SessionManagerInterface $session) { $this->_api = $api; $this->_orderHelper = $orderHelper; $this->_apiConfig = $apiConfig; $this->_context = $context; $this->_eventManager = $context->getEventManager(); $this->_backendAuthSession = $backendAuthSession; $this->_messageManager = $messageManager; $this->_orderFactory = $orderFactory; $this->logger = $logger; $this->session = $session; $this->date = $date; $this->queueFactory = $queueFactory; $this->_api->initSdk(); }
/** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php * @magentoAppArea frontend */ public function testGetWishlistByCustomerId() { /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ $wishlist = $this->_objectManager->create('Magento\\Wishlist\\Model\\Wishlist')->loadByCustomerId($this->_fixtureCustomerId); /** @var \Magento\Framework\App\Request\Http $request */ $request = $this->_contextHelper->getRequest(); $request->setParam('wishlist_id', ''); $this->assertEquals($wishlist, $this->_wishlistHelper->getWishlist()); }
protected function setUp() { $this->customizationPath = '/' . implode('/', array('var', 'theme')); $this->request = $this->getMock('\\Magento\\Framework\\App\\Request\\Http', array(), array(), '', false); $this->filesystem = $this->getMock('Magento\\Framework\\App\\Filesystem', array(), array(), '', false); $this->session = $this->getMock('Magento\\Backend\\Model\\Session', array(), array(), '', false); $this->contextHelper = $this->getMock('Magento\\Framework\\App\\Helper\\Context', array(), array(), '', false); $this->directoryWrite = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Write', array(), array(), '', false); $this->themeFactory = $this->getMock('Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory', array(), array(), '', false); $this->theme = $this->getMock('Magento\\Core\\Model\\Theme', array(), array(), '', false); $this->customization = $this->getMock('Magento\\Framework\\View\\Design\\Theme\\Customization', array(), array(), '', false); $this->filesystem->expects($this->once())->method('getDirectoryWrite')->will($this->returnValue($this->directoryWrite)); $this->directoryWrite->expects($this->any())->method('create')->will($this->returnValue(true)); $this->contextHelper->expects($this->once())->method('getRequest')->will($this->returnValue($this->request)); $this->themeFactory->expects($this->any())->method('create')->will($this->returnValue($this->theme)); $this->theme->expects($this->any())->method('getCustomization')->will($this->returnValue($this->customization)); $this->request->expects($this->at(0))->method('getParam')->with(\Magento\Theme\Helper\Storage::PARAM_THEME_ID)->will($this->returnValue(6)); $this->request->expects($this->at(1))->method('getParam')->with(\Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE)->will($this->returnValue(\Magento\Theme\Model\Wysiwyg\Storage::TYPE_IMAGE)); $this->helper = new \Magento\Theme\Helper\Storage($this->contextHelper, $this->filesystem, $this->session, $this->themeFactory); }