/** * @param \Magento\Framework\View\TemplateEngineInterface $subject * @param bool $showBlockHints Whether to include block into the debugging information or not */ public function __construct(\Magento\Framework\View\TemplateEngineInterface $subject, $showBlockHints, \Magento\Framework\View\Element\Context $context) { $this->_subject = $subject; $this->_showBlockHints = $showBlockHints; $this->_cache = $context->getCache(); $this->_cacheState = $context->getCacheState(); }
public function __construct(\Magento\Framework\View\Element\Context $context, \Celebros\ConversionPro\Helper\Data $helper) { $this->_layout = $context->getLayout(); $this->_request = $context->getRequest(); $this->_helper = $helper; $this->addCelHandle('catalog_category_view', 'celebros_layered_catalog'); }
/** * RegionList constructor. * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\View\Element\Context $context * @param Config $config */ public function __construct(\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory, \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Element\Context $context, Config $config) { $this->storeManager = $storeManager; $this->request = $context->getRequest(); $this->config = $config; return parent::__construct($countryCollectionFactory, $regionCollectionFactory); }
public function __construct(\Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\Element\Context $context) { $this->filterManager = $context->getFilterManager(); parent::__construct($currencyFactory); $this->_scopeConfig = $scopeConfig; $this->_httpClient = new \Magento\Framework\HTTP\ZendClient(); }
protected function setUp() { $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->blockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\AbstractBlock')->setMethods(['setRenderedBlock', 'getTemplate', 'setTemplate'])->disableOriginalConstructor()->getMockForAbstractClass(); $this->layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->setMethods(['getBlock', 'getChildName'])->disableOriginalConstructor()->getMockForAbstractClass(); $this->layoutMock->expects($this->any())->method('getBlock')->will($this->returnValue($this->blockMock)); $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Context')->setMethods(['getLayout'])->disableOriginalConstructor()->getMock(); $this->contextMock->expects($this->any())->method('getLayout')->will($this->returnValue($this->layoutMock)); $this->renderList = $objectManagerHelper->getObject('Magento\\Framework\\View\\Element\\RendererList', ['context' => $this->contextMock]); }
/** * @param PaymentHelper $paymentHelper * @param Escaper $escaper */ public function __construct(PaymentHelper $paymentHelper, \Magento\Framework\View\Element\Context $context, \Smart2Pay\GlobalPay\Model\ConfiguredMethodsFactory $configuredMethodsFactory) { $this->_configuredMethodFactory = $configuredMethodsFactory; //$this->escaper = $escaper; $this->_request = $context->getRequest(); $this->_assetRepo = $context->getAssetRepository(); foreach ($this->methodCodes as $code) { $this->methods[$code] = $paymentHelper->getMethodInstance($code); } }
public function testToHtml() { $this->context->expects($this->once())->method('getEventManager')->will($this->returnValue($this->getMockForAbstractClass('\\Magento\\Framework\\Event\\ManagerInterface'))); $this->context->expects($this->once())->method('getScopeConfig')->will($this->returnValue($this->getMockForAbstractClass('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface'))); $this->config->expects($this->once())->method('getBaseConfig')->will($this->returnValue('the config data')); $object = new Config($this->context, $this->config, $this->fileManager, $this->pageConfig); $html = $object->toHtml(); $expectedFormat = <<<expected <script type="text/javascript"> the config data</script> expected; $this->assertStringMatchesFormat($expectedFormat, $html); }
/** * @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\TranslateInterface $translator * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\View\DesignInterface $design * @param \Magento\Framework\Session\SessionManagerInterface $session * @param \Magento\Framework\Session\SidResolverInterface $sidResolver * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\ConfigInterface $viewConfig * @param \Magento\Framework\App\Cache\StateInterface $cacheState * @param \Magento\Framework\Logger $logger * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\Filter\FilterManager $filterManager * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Framework\App\Filesystem $filesystem * @param \Magento\Framework\View\FileSystem $viewFileSystem * @param \Magento\Framework\View\TemplateEnginePool $enginePool * @param \Magento\Framework\App\State $appState * @param \Magento\Framework\StoreManagerInterface $storeManager * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(\Magento\Framework\App\RequestInterface $request, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\TranslateInterface $translator, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Session\SessionManagerInterface $session, \Magento\Framework\Session\SidResolverInterface $sidResolver, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\ConfigInterface $viewConfig, \Magento\Framework\App\Cache\StateInterface $cacheState, \Magento\Framework\Logger $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\App\Filesystem $filesystem, \Magento\Framework\View\FileSystem $viewFileSystem, \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Framework\StoreManagerInterface $storeManager) { parent::__construct($request, $layout, $eventManager, $urlBuilder, $translator, $cache, $design, $session, $sidResolver, $scopeConfig, $assetRepo, $viewConfig, $cacheState, $logger, $escaper, $filterManager, $localeDate, $inlineTranslation); $this->_storeManager = $storeManager; $this->_appState = $appState; $this->_logger = $logger; $this->_filesystem = $filesystem; $this->_viewFileSystem = $viewFileSystem; $this->enginePool = $enginePool; }
public function setUp() { $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false); $this->escaper = $this->getMock('Magento\\Framework\\Escaper', [], [], '', false); $this->context->expects($this->once())->method('getEscaper')->willReturn($this->escaper); $localeDate = $this->getMockForAbstractClass('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface', [], '', false); $this->context->expects($this->once())->method('getLocaleDate')->willReturn($localeDate); $this->urlBuilder = $this->getMockForAbstractClass('Magento\\Framework\\UrlInterface', [], '', false); $this->context->expects($this->once())->method('getUrlBuilder')->willReturn($this->urlBuilder); $this->layout = $this->getMockForAbstractClass('Magento\\Framework\\View\\LayoutInterface', [], '', false); $this->context->expects($this->once())->method('getLayout')->willReturn($this->layout); $this->eventManager = $this->getMockForAbstractClass('Magento\\Framework\\Event\\ManagerInterface', [], '', false); $this->context->expects($this->once())->method('getEventManager')->willReturn($this->eventManager); $this->scopeConfig = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface', [], '', false); $this->context->expects($this->once())->method('getScopeConfig')->willReturn($this->scopeConfig); $this->cache = $this->getMockForAbstractClass('Magento\\Framework\\App\\CacheInterface', [], '', false); $this->context->expects($this->once())->method('getCache')->willReturn($this->cache); $this->agreementCollection = $this->getMockBuilder('Magento\\Paypal\\Model\\ResourceModel\\Billing\\Agreement\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock(); $this->helper = $this->getMock('Magento\\Paypal\\Helper\\Data', [], [], '', false); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->block = $objectManager->getObject('Magento\\Paypal\\Block\\Billing\\Agreements', ['context' => $this->context, 'agreementCollection' => $this->agreementCollection, 'helper' => $this->helper]); }
/** * Constructor * * @param \Magento\Framework\View\Element\Context $context * @param array $data */ public function __construct(\Magento\Framework\View\Element\Context $context, array $data = []) { $this->_request = $context->getRequest(); $this->_layout = $context->getLayout(); $this->_eventManager = $context->getEventManager(); $this->_urlBuilder = $context->getUrlBuilder(); $this->_cache = $context->getCache(); $this->_design = $context->getDesignPackage(); $this->_session = $context->getSession(); $this->_sidResolver = $context->getSidResolver(); $this->_scopeConfig = $context->getScopeConfig(); $this->_assetRepo = $context->getAssetRepository(); $this->_viewConfig = $context->getViewConfig(); $this->_cacheState = $context->getCacheState(); $this->_logger = $context->getLogger(); $this->_escaper = $context->getEscaper(); $this->filterManager = $context->getFilterManager(); $this->_localeDate = $context->getLocaleDate(); $this->inlineTranslation = $context->getInlineTranslation(); if (isset($data['jsLayout'])) { $this->jsLayout = $data['jsLayout']; unset($data['jsLayout']); } parent::__construct($data); $this->_construct(); }
/** * ModifyPrice constructor. * * @param Data $helper Helper * @param \Magento\Framework\View\Element\Context $context Context */ public function __construct(Data $helper, \Magento\Framework\View\Element\Context $context) { $this->scopeConfig = $context->getScopeConfig(); $this->helper = $helper; }
/** * ModifyPrice constructor. * * @param Context $context Context */ public function __construct(Context $context) { $this->scopeConfig = $context->getScopeConfig(); }
/** * @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\View\DesignInterface $design * @param \Magento\Framework\Session\SessionManagerInterface $session * @param \Magento\Framework\Session\SidResolverInterface $sidResolver * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\ConfigInterface $viewConfig * @param \Magento\Framework\App\Cache\StateInterface $cacheState * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\Filter\FilterManager $filterManager * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\AuthorizationInterface $authorization * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(\Magento\Framework\App\RequestInterface $request, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\App\CacheInterface $cache, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Session\SessionManagerInterface $session, \Magento\Framework\Session\SidResolverInterface $sidResolver, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\ConfigInterface $viewConfig, \Magento\Framework\App\Cache\StateInterface $cacheState, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Escaper $escaper, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, \Magento\Framework\AuthorizationInterface $authorization) { $this->_authorization = $authorization; parent::__construct($request, $layout, $eventManager, $urlBuilder, $cache, $design, $session, $sidResolver, $scopeConfig, $assetRepo, $viewConfig, $cacheState, $logger, $escaper, $filterManager, $localeDate, $inlineTranslation); }
/** * ModifyPrice constructor. * @param \Magento\Framework\View\Element\Context $context * @param Session $customerSession * @param CustomerRepository $customerRepository */ public function __construct(\Magento\Framework\View\Element\Context $context, Session $customerSession, CustomerRepository $customerRepository) { $this->scopeConfig = $context->getScopeConfig(); $this->customerSession = $customerSession; $this->customerRepository = $customerRepository; }
public function __construct(\Magento\Framework\View\Element\Context $context, \Celebros\AutoComplete\Helper\Data $celHelper) { $this->_layout = $context->getLayout(); $this->_request = $context->getRequest(); $this->_helper = $celHelper; }