Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->setMethods(['getUrlBuilder'])->getMock();
     $this->urlBuilderMock = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilderMock);
     $this->contactForm = new ContactForm($this->contextMock);
 }
Exemplo n.º 2
0
 /**
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $category = $this->getCategory();
     $title = $category ? $category->getName() : $this->config->getBlogName();
     $metaTitle = $category ? $category->getMetaTitle() ? $category->getMetaTitle() : $category->getName() : $this->config->getBaseMetaTitle();
     $metaDescription = $category ? $category->getMetaDescription() ? $category->getMetaDescription() : $category->getName() : $this->config->getBaseMetaDescription();
     $metaKeywords = $category ? $category->getMetaKeywords() ? $category->getMetaKeywords() : $category->getName() : $this->config->getBaseMetaKeywords();
     $this->pageConfig->getTitle()->set($metaTitle);
     $this->pageConfig->setDescription($metaDescription);
     $this->pageConfig->setKeywords($metaKeywords);
     /** @var \Magento\Theme\Block\Html\Title $pageMainTitle */
     $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
     if ($pageMainTitle) {
         $pageMainTitle->setPageTitle($title);
     }
     /** @var \Magento\Theme\Block\Html\Breadcrumbs $breadcrumbs */
     if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
         $breadcrumbs->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->context->getUrlBuilder()->getBaseUrl()])->addCrumb('blog', ['label' => $this->config->getBlogName(), 'title' => $this->config->getBlogName(), 'link' => $this->config->getBaseUrl()]);
         if ($category) {
             $ids = $category->getParentIds();
             $ids[] = 0;
             $parents = $this->categoryCollectionFactory->create()->addFieldToFilter('entity_id', $ids)->addNameToSelect()->excludeRoot()->setOrder('level', 'asc');
             /** @var \Mirasvit\Blog\Model\Category $cat */
             foreach ($parents as $cat) {
                 $breadcrumbs->addCrumb($cat->getId(), ['label' => $cat->getName(), 'title' => $cat->getName(), 'link' => $cat->getUrl()]);
             }
             $breadcrumbs->addCrumb($category->getId(), ['label' => $category->getName(), 'title' => $category->getName()]);
         }
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @param TemplateContext $context
  * @param Context $renderContext
  * @param ContentTypeFactory $contentTypeFactory
  * @param ConfigFactory $configFactory
  * @param ConfigBuilderInterface $configBuilder
  * @param DataProviderFactory $dataProviderFactory
  * @param Manager $dataProviderManager
  * @param FilterPool $filterPool
  * @param ResolverInterface $localeResolver
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(TemplateContext $context, Context $renderContext, ContentTypeFactory $contentTypeFactory, ConfigFactory $configFactory, ConfigBuilderInterface $configBuilder, DataProviderFactory $dataProviderFactory, Manager $dataProviderManager, FilterPool $filterPool, ResolverInterface $localeResolver, array $data = [])
 {
     $this->localeDate = $context->getLocaleDate();
     $this->scopeConfig = $context->getScopeConfig();
     $this->localeResolver = $localeResolver;
     parent::__construct($context, $renderContext, $contentTypeFactory, $configFactory, $configBuilder, $dataProviderFactory, $dataProviderManager, $filterPool, $data);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  *
  * @param Context         $context
  * @param Config          $config
  * @param FormatInterface $localeFormat
  * @param SearchHelper    $searchHelper
  */
 public function __construct(Context $context, Config $config, FormatInterface $localeFormat, SearchHelper $searchHelper)
 {
     $this->storeManager = $context->getStoreManager();
     $this->config = $config;
     $this->localeFormat = $localeFormat;
     $this->searchHelper = $searchHelper;
     parent::__construct($context);
 }
Exemplo n.º 5
0
 /**
  * Validate3d constructor.
  *
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param array $data
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param \Magento\Checkout\Model\Session $checkoutSession
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, array $data = [], \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession)
 {
     $this->_orderFactory = $orderFactory;
     $this->_checkoutSession = $checkoutSession;
     $this->_request = $context->getRequest();
     parent::__construct($context, $data);
     $this->_getOrder();
 }
Exemplo n.º 6
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
 }
Exemplo n.º 7
0
 public function __construct(Template\Context $context, \Celebros\ConversionPro\Helper\Data $helper, \Celebros\ConversionPro\Helper\Search $searchHelper, \Magento\Framework\Registry $registry, array $data = [])
 {
     $this->helper = $helper;
     $this->searchHelper = $searchHelper;
     $this->registry = $registry;
     $this->url = $context->getUrlBuilder();
     parent::__construct($context, $data);
 }
 public function __construct(Context $context, HelperData $helperData, ObjectManagerInterface $objectManager, array $data = [])
 {
     $this->helperData = $helperData;
     $this->objectManager = $objectManager;
     //$this->storeManager  = $storeManager;
     $this->localeDate = $context->getLocaleDate();
     parent::__construct($context, $data);
 }
Exemplo n.º 9
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param \Magento\SalesRule\Model\Rss\Discounts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\SalesRule\Model\Rss\Discounts $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->storeManager = $context->getStoreManager();
     $this->rssModel = $rssModel;
     $this->httpContext = $httpContext;
     $this->rssUrlBuilder = $rssUrlBuilder;
     parent::__construct($context, $data);
 }
Exemplo n.º 10
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Mageplaza\Blog\Model\CategoryFactory $rssModel, \Mageplaza\Blog\Helper\Data $helper, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->helper = $helper;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
 }
Exemplo n.º 11
0
 protected function setUp()
 {
     $this->storeManager = $this->getMockBuilder('Magento\\Framework\\Store\\StoreManagerInterface')->getMock();
     $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false);
     $this->context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManager));
     $this->corePostDataHelper = $this->getMock('Magento\\Core\\Helper\\PostData', [], [], '', false);
     $this->switcher = (new ObjectManager($this))->getObject('Magento\\Store\\Block\\Switcher', ['context' => $this->context, 'postDataHelper' => $this->corePostDataHelper]);
 }
Exemplo n.º 12
0
 /**
  * @param Context $context
  * @param DataStore $dataStore
  * @param MagentoAPI $magentoAPI
  * @param UrlInterface $urlBuilder
  */
 public function __construct(Context $context, DataStore $dataStore, MagentoAPI $magentoAPI, UrlInterface $urlBuilder)
 {
     $this->assetRepository = $context->getAssetRepository();
     $this->dataStore = $dataStore;
     $this->magentoAPI = $magentoAPI;
     $this->logger = $context->getLogger();
     $this->urlBuilder = $urlBuilder;
     parent::__construct($context);
 }
Exemplo n.º 13
0
 public function testRenderLink()
 {
     $blockHtml = 'test';
     $name = 'test_name';
     $this->context->getLayout()->expects($this->once())->method('renderElement')->with($name)->willReturn($blockHtml);
     /** @var \Magento\Framework\View\Element\AbstractBlock $link */
     $link = $this->getMockBuilder('Magento\\Framework\\View\\Element\\AbstractBlock')->disableOriginalConstructor()->getMock();
     $link->expects($this->once())->method('getNameInLayout')->willReturn($name);
     $this->assertEquals($blockHtml, $this->block->renderLink($link));
 }
Exemplo n.º 14
0
 public function testGetFaviconFile()
 {
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', array(), array(), '', false);
     $storeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue('baseUrl/'));
     $this->_context->getStoreManager()->expects($this->any())->method('getStore')->will($this->returnValue($storeMock));
     $this->_context->getScopeConfig()->expects($this->any())->method('getValue')->will($this->returnValue('scopeConfig'));
     $mediaDirMock = $this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\Read', array(), array(), '', false);
     $mediaDirMock->expects($this->any())->method('isFile')->with('favicon/scopeConfig')->will($this->returnValue(true));
     $this->_context->getFilesystem()->expects($this->once())->method('getDirectoryRead')->will($this->returnValue($mediaDirMock));
     $this->assertEquals('baseUrl/favicon/scopeConfig', $this->_block->getFaviconFile());
 }
Exemplo n.º 15
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
  * @param \Magento\Catalog\Model\Rss\Category $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Customer\Model\Session $customerSession
  * @param CategoryRepositoryInterface $categoryRepository
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Rss\Category $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, CategoryRepositoryInterface $categoryRepository, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->categoryFactory = $categoryFactory;
     $this->customerSession = $customerSession;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     $this->categoryRepository = $categoryRepository;
     parent::__construct($context, $data);
 }
Exemplo n.º 16
0
 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->getMock();
     $this->sessionConfigMock = $this->getMockBuilder('Magento\\Framework\\Session\\Config')->disableOriginalConstructor()->getMock();
     $this->ipValidatorMock = $this->getMockBuilder('Magento\\Framework\\Validator\\Ip')->disableOriginalConstructor()->getMock();
     $validtorMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\File\\Validator')->setMethods(['isValid'])->disableOriginalConstructor()->getMock();
     $scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config')->setMethods(['isSetFlag'])->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfigMock));
     $this->contextMock->expects($this->any())->method('getValidator')->will($this->returnValue($validtorMock));
     $this->model = new \Magento\Framework\View\Element\Js\Cookie($this->contextMock, $this->sessionConfigMock, $this->ipValidatorMock, []);
 }
Exemplo n.º 17
0
 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->context = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->disableOriginalConstructor()->setMethods(['getRequest', 'getResponse'])->getMock();
     $this->response = $this->getMockBuilder('Magento\\Framework\\App\\Response\\Http')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->once())->method('getResponse')->willReturn($this->response);
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->getMockForAbstractClass();
     $this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->feedRepository = $this->getMockBuilder('Magento\\SampleServiceContractNew\\API\\FeedRepositoryInterface')->getMockForAbstractClass();
     $this->feedTransformer = $this->getMockBuilder('Magento\\SampleServiceContractNew\\Model\\FeedTransformer')->disableOriginalConstructor()->getMock();
     $this->controller = $objectManager->getObject('Magento\\SampleServiceContractNew\\Controller\\Feed\\View', ['feedRepository' => $this->feedRepository, 'feedTransformer' => $this->feedTransformer, 'context' => $this->context]);
 }
Exemplo n.º 18
0
 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->setMethods(['getRequest'])->getMock();
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->getMockForAbstractClass();
     $this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->productTypeList = $this->getMockBuilder('Magento\\Catalog\\Api\\ProductTypeListInterface')->getMockForAbstractClass();
     $this->productRepository = $this->getMockBuilder('Magento\\Catalog\\Api\\ProductRepositoryInterface')->getMockForAbstractClass();
     $this->searchCriteriaBuilder = $this->getMockBuilder('Magento\\Framework\\Api\\SearchCriteriaBuilder')->disableOriginalConstructor()->getMock();
     $this->filterBuilder = $this->getMockBuilder('Magento\\Framework\\Api\\FilterBuilder')->disableOriginalConstructor()->getMock();
     $this->block = $objectManager->getObject('Magento\\SampleServiceContractClient\\Block\\ProductList', ['context' => $this->context, 'productTypeList' => $this->productTypeList, 'productRepository' => $this->productRepository, 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'filterBuilder' => $this->filterBuilder]);
 }
Exemplo n.º 19
0
 /**
  * @return $this
  *
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $tag = $this->getTag();
     $this->pageConfig->getTitle()->set(__('Tag: %1', $tag->getName()));
     if ($tag && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
         $breadcrumbs->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->context->getUrlBuilder()->getBaseUrl()]);
         $breadcrumbs->addCrumb('blog', ['label' => __('Blog'), 'title' => __('Blog')]);
         $breadcrumbs->addCrumb($tag->getId(), ['label' => __('Tag: %1', $tag->getName()), 'title' => __('Tag: %1', $tag->getName())]);
     }
     return $this;
 }
Exemplo n.º 20
0
 protected function setUp()
 {
     $this->storeManager = $this->getMock('\\Magento\\Framework\\StoreManagerInterface');
     $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', array(), array(), '', false);
     $this->context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManager));
     $this->collection = $this->getMock('Magento\\Review\\Model\\Resource\\Review\\Product\\Collection', array(), array(), '', false);
     $this->collectionFactory = $this->getMock('Magento\\Review\\Model\\Resource\\Review\\Product\\CollectionFactory', array('create'), array(), '', false);
     $this->collectionFactory->expects($this->once())->method('create')->will($this->returnValue($this->collection));
     $this->currentCustomer = $this->getMock('Magento\\Customer\\Helper\\Session\\CurrentCustomer', array(), array(), '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->object = $this->objectManagerHelper->getObject('Magento\\Review\\Block\\Customer\\Recent', array('context' => $this->context, 'collectionFactory' => $this->collectionFactory, 'currentCustomer' => $this->currentCustomer));
 }
Exemplo n.º 21
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Catalog\Helper\Output $outputHelper
  * @param \Magento\Msrp\Helper\Data $msrpHelper
  * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
  * @param \Magento\Catalog\Model\Rss\Product\Special $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param \Magento\Framework\Locale\ResolverInterface $localeResolver
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Helper\Output $outputHelper, \Magento\Msrp\Helper\Data $msrpHelper, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Model\Rss\Product\Special $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [])
 {
     $this->outputHelper = $outputHelper;
     $this->imageHelper = $imageHelper;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->priceCurrency = $priceCurrency;
     $this->msrpHelper = $msrpHelper;
     $this->httpContext = $httpContext;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
     $this->localeResolver = $localeResolver;
 }
Exemplo n.º 22
0
 /**
  * Init mocks and model
  */
 public function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', ['getEventManager', 'getStoreConfig', 'getScopeConfig'], [], '', false);
     $this->priceCurrencyMock = $this->getMock('Magento\\Directory\\Model\\PriceCurrency', [], [], '', false);
     $this->taxHelperMock = $this->getMock('Magento\\Tax\\Helper\\Data', [], [], '', false);
     $eventManagerMock = $this->getMockBuilder('Magento\\Framework\\Event\\ManagerInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $storeConfigMock = $this->getMockBuilder('Magento\\Store\\Model\\Store\\Config')->disableOriginalConstructor()->getMock();
     $scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->contextMock->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManagerMock));
     $this->contextMock->expects($this->any())->method('getStoreConfig')->will($this->returnValue($storeConfigMock));
     $this->contextMock->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfigMock));
     $this->model = new Adjustment($this->contextMock, $this->priceCurrencyMock, $this->taxHelperMock);
 }
Exemplo n.º 23
0
 protected function setUp()
 {
     $this->storeManager = $this->getMock('\\Magento\\Store\\Model\\StoreManagerInterface');
     $this->requestMock = $this->getMock('\\Magento\\Framework\\App\\RequestInterface');
     $this->reviewDataMock = $this->getMockBuilder('\\Magento\\Review\\Helper\\Data')->disableOriginalConstructor()->getMock();
     $this->reviewDataMock->expects($this->once())->method('getIsGuestAllowToWrite')->willReturn(true);
     $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false);
     $this->context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManager));
     $this->context->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
     $this->productRepository = $this->getMock('\\Magento\\Catalog\\Api\\ProductRepositoryInterface');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->object = $this->objectManagerHelper->getObject('Magento\\Review\\Block\\Form', ['context' => $this->context, 'reviewData' => $this->reviewDataMock, 'productRepository' => $this->productRepository]);
 }
Exemplo n.º 24
0
 /**
  * Constructor
  *
  * @param View\Element\Template\Context $context
  * @param View\LayoutFactory $layoutFactory
  * @param View\Layout\ReaderPool $layoutReaderPool
  * @param Framework\Translate\InlineInterface $translateInline
  * @param View\Layout\BuilderFactory $layoutBuilderFactory
  * @param View\Layout\GeneratorPool $generatorPool
  * @param bool $isIsolated
  */
 public function __construct(View\Element\Template\Context $context, View\LayoutFactory $layoutFactory, View\Layout\ReaderPool $layoutReaderPool, Framework\Translate\InlineInterface $translateInline, View\Layout\BuilderFactory $layoutBuilderFactory, View\Layout\GeneratorPool $generatorPool, $isIsolated = false)
 {
     $this->layoutFactory = $layoutFactory;
     $this->layoutBuilderFactory = $layoutBuilderFactory;
     $this->layoutReaderPool = $layoutReaderPool;
     $this->eventManager = $context->getEventManager();
     $this->request = $context->getRequest();
     $this->translateInline = $translateInline;
     // TODO Shared layout object will be deleted in MAGETWO-28359
     $this->layout = $isIsolated ? $this->layoutFactory->create(['reader' => $this->layoutReaderPool, 'generatorPool' => $generatorPool]) : $context->getLayout();
     $this->layout->setGeneratorPool($generatorPool);
     $this->initLayoutBuilder();
 }
Exemplo n.º 25
0
 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods(['isSecure', 'getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getParam', 'getCookie'])->getMock();
     $this->layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->disableOriginalConstructor()->getMock();
     $this->layoutUpdateMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\ProcessorInterface')->disableOriginalConstructor()->getMock();
     $this->urlBuilderMock = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
     $this->contextMock->expects($this->any())->method('getLayout')->willReturn($this->layoutMock);
     $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilderMock);
     $this->layoutMock->expects($this->any())->method('getUpdate')->willReturn($this->layoutUpdateMock);
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->blockJavascript = $objectManager->getObject('Magento\\PageCache\\Block\\Javascript', ['context' => $this->contextMock]);
 }
Exemplo n.º 26
0
 public function setUp()
 {
     $this->renderContextMock = $this->getMock('Magento\\Framework\\View\\Element\\UiComponent\\Context', ['getNamespace', 'getStorage', 'getRequestParam'], [], '', false);
     $this->contextMock = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', ['getAssetRepository'], [], '', false);
     $this->contentTypeFactoryMock = $this->getMock('Magento\\Ui\\ContentType\\ContentTypeFactory', [], [], '', false);
     $this->configurationBuilderMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\ConfigBuilderInterface');
     $this->assetRepoMock = $this->getMock('Magento\\Framework\\View\\Asset\\Repository', [], [], '', false);
     $this->contextMock->expects($this->any())->method('getAssetRepository')->willReturn($this->assetRepoMock);
     $this->configFactoryMock = $this->getMock('Magento\\Framework\\View\\Element\\UiComponent\\ConfigFactory', ['create'], [], '', false);
     $this->configBuilderMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\UiComponent\\ConfigBuilderInterface', [], '', false);
     $this->dataProviderFactoryMock = $this->getMock('Magento\\Ui\\DataProvider\\Factory', [], [], '', false);
     $this->dataProviderManagerMock = $this->getMock('Magento\\Ui\\DataProvider\\Manager', [], [], '', false);
     $this->view = new \Magento\Ui\Component\Paging($this->contextMock, $this->renderContextMock, $this->contentTypeFactoryMock, $this->configFactoryMock, $this->configBuilderMock, $this->dataProviderFactoryMock, $this->dataProviderManagerMock);
 }
Exemplo n.º 27
0
 /**
  * Set up
  *
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->contextMock = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', ['getEventManager', 'getScopeConfig', 'getCacheState', 'getCache', 'getInlineTranslation', 'getSidResolver', 'getSession', 'getEscaper', 'getUrlBuilder'], [], '', false);
     $this->customerViewHelperMock = $this->getMock('Magento\\Customer\\Helper\\View', [], [], '', false);
     $this->persistentSessionHelperMock = $this->getMock('Magento\\Persistent\\Helper\\Session', ['getSession'], [], '', false);
     $this->customerRepositoryMock = $this->getMockForAbstractClass('Magento\\Customer\\Api\\CustomerRepositoryInterface', [], '', false, true, true, ['getById']);
     $this->eventManagerMock = $this->getMockForAbstractClass('Magento\\Framework\\Event\\ManagerInterface', [], '', false, true, true, ['dispatch']);
     $this->scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface', [], '', false, true, true, ['getValue']);
     $this->cacheStateMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Cache\\StateInterface', [], '', false, true, true, ['isEnabled']);
     $this->cacheMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\CacheInterface', [], '', false, true, true, ['load']);
     $this->sidResolverMock = $this->getMockForAbstractClass('Magento\\Framework\\Session\\SidResolverInterface', [], '', false, true, true, ['getSessionIdQueryParam']);
     $this->sessionMock = $this->getMockForAbstractClass('Magento\\Framework\\Session\\SessionManagerInterface', [], '', false, true, true, ['getSessionId']);
     $this->escaperMock = $this->getMockForAbstractClass('Magento\\Framework\\Escaper', [], '', false, true, true, ['escapeHtml']);
     $this->urlBuilderMock = $this->getMockForAbstractClass('Magento\\Framework\\UrlInterface', [], '', false, true, true, ['getUrl']);
     $this->contextMock->expects($this->once())->method('getEventManager')->willReturn($this->eventManagerMock);
     $this->contextMock->expects($this->once())->method('getScopeConfig')->willReturn($this->scopeConfigMock);
     $this->contextMock->expects($this->once())->method('getCacheState')->willReturn($this->cacheStateMock);
     $this->contextMock->expects($this->once())->method('getCache')->willReturn($this->cacheMock);
     $this->contextMock->expects($this->once())->method('getSidResolver')->willReturn($this->sidResolverMock);
     $this->contextMock->expects($this->once())->method('getSession')->willReturn($this->sessionMock);
     $this->contextMock->expects($this->once())->method('getEscaper')->willReturn($this->escaperMock);
     $this->contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($this->urlBuilderMock);
     $this->additional = $this->objectManager->getObject('Magento\\Persistent\\Block\\Header\\Additional', ['context' => $this->contextMock, 'customerViewHelper' => $this->customerViewHelperMock, 'persistentSessionHelper' => $this->persistentSessionHelperMock, 'customerRepository' => $this->customerRepositoryMock, 'data' => []]);
 }
 /**
  * @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\Translate\Inline\StateInterface $inlineTranslation
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\Framework\View\FileSystem $viewFileSystem
  * @param \Magento\Framework\View\TemplateEnginePool $enginePool
  * @param \Magento\Framework\App\State $appState
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\View\Page\Config $pageConfig
  * @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
  * @param \Magento\Framework\View\Element\Template\File\Validator $validator
  * @param \Ced\DevTool\Helper\Data $devToolHelper
  * @param \Magento\Framework\Registry $registry
  * @param \Ced\DevTool\Model\Config $config
  * @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\Filesystem $filesystem, \Magento\Framework\View\FileSystem $viewFileSystem, \Magento\Framework\View\TemplateEnginePool $enginePool, \Magento\Framework\App\State $appState, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Page\Config $pageConfig, \Magento\Framework\View\Element\Template\File\Resolver $resolver, \Magento\Framework\View\Element\Template\File\Validator $validator, \Ced\DevTool\Helper\Data $devToolHelper, \Magento\Framework\Registry $registry, \Ced\DevTool\Model\Config $config)
 {
     $this->_devToolHelper = $devToolHelper;
     $this->registry = $registry;
     $this->_config = $config;
     parent::__construct($request, $layout, $eventManager, $urlBuilder, $cache, $design, $session, $sidResolver, $scopeConfig, $assetRepo, $viewConfig, $cacheState, $logger, $escaper, $filterManager, $localeDate, $inlineTranslation, $filesystem, $viewFileSystem, $enginePool, $appState, $storeManager, $pageConfig, $resolver, $validator);
 }
Exemplo n.º 29
0
 public function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->rendererPool = $this->getMockBuilder('Magento\\Framework\\Pricing\\Render\\RendererPool')->disableOriginalConstructor()->setMethods(['createAmountRender'])->getMock();
     $layout = $this->getMock('Magento\\Framework\\View\\LayoutInterface');
     $eventManager = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $storeConfig = $this->getMockBuilder('Magento\\Store\\Model\\Store\\Config')->disableOriginalConstructor()->getMock();
     $this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->any())->method('getLayout')->will($this->returnValue($layout));
     $this->context->expects($this->any())->method('getEventManager')->will($this->returnValue($eventManager));
     $this->context->expects($this->any())->method('getStoreConfig')->will($this->returnValue($storeConfig));
     $this->context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfigMock));
     $this->saleable = $this->getMock('Magento\\Framework\\Pricing\\SaleableInterface');
     $this->price = $this->getMock('Magento\\Framework\\Pricing\\Price\\PriceInterface');
     $this->model = $this->objectManager->getObject('Magento\\Framework\\Pricing\\Render\\PriceBox', ['context' => $this->context, 'saleableItem' => $this->saleable, 'price' => $this->price, 'rendererPool' => $this->rendererPool]);
 }
Exemplo n.º 30
0
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Riskified\Decider\Api\Config $apiConfig, \Magento\Framework\Session\SessionManagerInterface $session, array $data = [])
 {
     $this->validator = $context->getValidator();
     $this->resolver = $context->getResolver();
     $this->_filesystem = $context->getFilesystem();
     $this->templateEnginePool = $context->getEnginePool();
     $this->_storeManager = $context->getStoreManager();
     $this->_appState = $context->getAppState();
     $this->templateContext = $this;
     $this->pageConfig = $context->getPageConfig();
     $this->apiConfig = $apiConfig;
     $this->session = $session;
     parent::__construct($context, $data);
 }