• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP App\ViewInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\App\ViewInterface的典型用法代码示例。如果您正苦于以下问题:PHP ViewInterface类的具体用法?PHP ViewInterface怎么用?PHP ViewInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ViewInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getPaymentMethodsHtml

 /**
  * Get payment method step html
  *
  * @param \Magento\Framework\App\ViewInterface $view
  * @return string
  */
 public function getPaymentMethodsHtml(\Magento\Framework\App\ViewInterface $view)
 {
     $layout = $view->getLayout();
     $update = $layout->getUpdate();
     $update->load('checkout_onepage_paymentmethod');
     $layout->generateXml();
     $layout->generateElements();
     $output = $layout->getOutput();
     return $output;
 }
开发者ID:steegi,项目名称:paystand-magento2,代码行数:16,代码来源:Data.php


示例2: setUp

 protected function setUp()
 {
     $this->_eventManagerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface', [], [], '', false);
     $this->_actionFlagMock = $this->getMock('Magento\\Framework\\App\\ActionFlag', [], [], '', false);
     $this->_redirectMock = $this->getMock('Magento\\Framework\\App\\Response\\RedirectInterface', [], [], '', false);
     $this->_requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
     $this->_responseMock = $this->getMock('Magento\\Framework\\App\\ResponseInterface', [], [], '', false);
     $this->pageConfigMock = $this->getMock('Magento\\Framework\\View\\Page\\Config', ['getConfig'], [], '', false);
     $this->viewMock = $this->getMock('Magento\\Framework\\App\\ViewInterface');
     $this->viewMock->expects($this->any())->method('getPage')->will($this->returnValue($this->pageConfigMock));
     $this->pageConfigMock->expects($this->any())->method('getConfig')->will($this->returnValue(1));
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->action = $this->objectManagerHelper->getObject('Magento\\Framework\\App\\Test\\Unit\\Action\\ActionFake', ['request' => $this->_requestMock, 'response' => $this->_responseMock, 'eventManager' => $this->_eventManagerMock, 'redirect' => $this->_redirectMock, 'actionFlag' => $this->_actionFlagMock, 'view' => $this->viewMock]);
     \Magento\Framework\Profiler::disable();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:ActionTest.php


示例3: prepareAndRender

 /**
  * Prepares product view page - inits layout and all needed stuff
  *
  * $params can have all values as $params in \Magento\Catalog\Helper\Product - initProduct().
  * Plus following keys:
  *   - 'buy_request' - \Magento\Framework\Object holding buyRequest to configure product
  *   - 'specify_options' - boolean, whether to show 'Specify options' message
  *   - 'configure_mode' - boolean, whether we're in Configure-mode to edit product configuration
  *
  * @param int $productId
  * @param \Magento\Framework\App\Action\Action $controller
  * @param null|\Magento\Framework\Object $params
  *
  * @return \Magento\Catalog\Helper\Product\View
  * @throws \Magento\Framework\Model\Exception
  */
 public function prepareAndRender($productId, $controller, $params = null)
 {
     // Prepare data
     $productHelper = $this->_catalogProduct;
     if (!$params) {
         $params = new \Magento\Framework\Object();
     }
     // Standard algorithm to prepare and render product view page
     $product = $productHelper->initProduct($productId, $controller, $params);
     if (!$product) {
         throw new \Magento\Framework\Model\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED);
     }
     $buyRequest = $params->getBuyRequest();
     if ($buyRequest) {
         $productHelper->prepareProductOptions($product, $buyRequest);
     }
     if ($params->hasConfigureMode()) {
         $product->setConfigureMode($params->getConfigureMode());
     }
     $this->_eventManager->dispatch('catalog_controller_product_view', array('product' => $product));
     $this->_catalogSession->setLastViewedProductId($product->getId());
     $this->initProductLayout($product, $controller, $params);
     if ($controller instanceof \Magento\Catalog\Controller\Product\View\ViewInterface) {
         $this->_view->getLayout()->initMessages($this->messageGroups);
     } else {
         throw new \Magento\Framework\Model\Exception(__('Bad controller interface for showing product'), $this->ERR_BAD_CONTROLLER_INTERFACE);
     }
     $this->_view->renderLayout();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:46,代码来源:View.php


示例4: setUp

 public function setUp()
 {
     $this->request = $this->getMock('Magento\\Framework\\App\\RequestInterface');
     $this->response = $this->getMock('Magento\\Framework\\App\\ResponseInterface');
     $this->categoryHelper = $this->getMock('Magento\\Catalog\\Helper\\Category', [], [], '', false);
     $this->objectManager = $this->getMock('Magento\\Framework\\ObjectManager', [], [], '', false);
     $this->eventManager = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->update = $this->getMock('Magento\\Framework\\View\\Layout\\ProcessorInterface');
     $this->layout = $this->getMock('Magento\\Framework\\View\\Layout', [], [], '', false);
     $this->layout->expects($this->any())->method('getUpdate')->will($this->returnValue($this->update));
     $this->view = $this->getMock('Magento\\Framework\\App\\ViewInterface');
     $this->view->expects($this->any())->method('getLayout')->will($this->returnValue($this->layout));
     $this->context = $this->getMock('Magento\\Backend\\App\\Action\\Context', [], [], '', false);
     $this->context->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->context->expects($this->any())->method('getResponse')->will($this->returnValue($this->response));
     $this->context->expects($this->any())->method('getObjectManager')->will($this->returnValue($this->objectManager));
     $this->context->expects($this->any())->method('getEventManager')->will($this->returnValue($this->eventManager));
     $this->context->expects($this->any())->method('getView')->will($this->returnValue($this->view));
     $this->category = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $this->categoryFactory = $this->getMock('Magento\\Catalog\\Model\\CategoryFactory', ['create'], [], '', false);
     $this->store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $this->storeManager = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface');
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $this->catalogDesign = $this->getMock('Magento\\Catalog\\Model\\Design', [], [], '', false);
     $this->layoutHelper = $this->getMock('Magento\\Theme\\Helper\\Layout', [], [], '', false);
     $this->action = (new ObjectManager($this))->getObject('Magento\\Catalog\\Controller\\Category\\View', ['context' => $this->context, 'catalogDesign' => $this->catalogDesign, 'categoryFactory' => $this->categoryFactory, 'storeManager' => $this->storeManager]);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:27,代码来源:ViewTest.php


示例5: setUp

 protected function setUp()
 {
     $this->shipmentLoaderMock = $this->getMock('Magento\\Shipping\\Controller\\Adminhtml\\Order\\ShipmentLoader', ['setOrderId', 'setShipmentId', 'setShipment', 'setTracking', 'load', '__wakeup'], [], '', false);
     $this->shipmentCommentSenderMock = $this->getMock('Magento\\Sales\\Model\\Order\\Email\\Sender\\ShipmentCommentSender', ['send', '__wakeup'], [], '', false);
     $this->requestMock = $this->getMock('Magento\\Framework\\App\\Request\\Http', ['getParam', 'getPost', 'setParam', '__wakeup'], [], '', false);
     $this->responseMock = $this->getMock('Magento\\Framework\\App\\Response\\Http', ['setBody', 'representJson', '__wakeup'], [], '', false);
     $this->resultLayoutFactoryMock = $this->getMock('Magento\\Framework\\View\\Result\\LayoutFactory', ['create'], [], '', false);
     $this->resultPageMock = $this->getMockBuilder('Magento\\Framework\\View\\Result\\Page')->disableOriginalConstructor()->getMock();
     $this->shipmentMock = $this->getMock('Magento\\Sales\\Model\\Order\\Shipment', ['save', 'addComment', '__wakeup'], [], '', false);
     $this->viewInterfaceMock = $this->getMock('Magento\\Framework\\App\\ViewInterface', [], [], '', false);
     $this->objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $contextMock = $this->getMock('Magento\\Backend\\App\\Action\\Context', ['getRequest', 'getResponse', 'getTitle', 'getView', 'getObjectManager', '__wakeup'], [], '', false);
     $this->viewInterfaceMock->expects($this->any())->method('getPage')->will($this->returnValue($this->resultPageMock));
     $contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->requestMock));
     $contextMock->expects($this->any())->method('getResponse')->will($this->returnValue($this->responseMock));
     $contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->viewInterfaceMock));
     $contextMock->expects($this->any())->method('getObjectManager')->will($this->returnValue($this->objectManagerMock));
     $this->controller = new \Magento\Shipping\Controller\Adminhtml\Order\Shipment\AddComment($contextMock, $this->shipmentLoaderMock, $this->shipmentCommentSenderMock, $this->resultLayoutFactoryMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:AddCommentTest.php


示例6: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->requestMock = $this->getMockForAbstractClassBuilder('Magento\\Framework\\App\\RequestInterface', ['isDispatched', 'initForward', 'setDispatched', 'isForwarded']);
     $this->breadcrumbsBlockMock = $this->getMockForAbstractClassBuilder('Magento\\Framework\\View\\Element\\BlockInterface', ['addLink']);
     $this->menuBlockMock = $this->getMockForAbstractClassBuilder('Magento\\Framework\\View\\Element\\BlockInterface', ['setActive', 'getMenuModel']);
     $this->viewMock = $this->getMockForAbstractClassBuilder('Magento\\Framework\\App\\ViewInterface');
     $this->layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->disableOriginalConstructor()->getMock();
     $this->switcherBlockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\BlockInterface')->disableOriginalConstructor()->getMock();
     $this->contextMock = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->getMock();
     $this->fileFactoryMock = $this->getMockBuilder('Magento\\Framework\\App\\Response\\Http\\FileFactory')->disableOriginalConstructor()->getMock();
     $this->menuModelMock = $this->getMockBuilder('Magento\\Backend\\Model\\Menu')->disableOriginalConstructor()->getMock();
     $this->abstractBlockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\AbstractBlock')->setMethods(['getCsvFile', 'getExcelFile', 'setSaveParametersInSession', 'getCsv', 'getExcel'])->disableOriginalConstructor()->getMock();
     $this->menuModelMock->expects($this->any())->method('getParentItems')->willReturn([]);
     $this->menuBlockMock->expects($this->any())->method('getMenuModel')->willReturn($this->menuModelMock);
     $this->viewMock->expects($this->any())->method('getLayout')->willReturn($this->layoutMock);
     $this->contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
     $this->contextMock->expects($this->any())->method('getView')->willReturn($this->viewMock);
     $this->layoutMock->expects($this->any())->method('getBlock')->will($this->returnValueMap([['breadcrumbs', $this->breadcrumbsBlockMock], ['menu', $this->menuBlockMock], ['store_switcher', $this->switcherBlockMock]]));
     $this->layoutMock->expects($this->any())->method('getChildBlock')->willReturn($this->abstractBlockMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:AbstractControllerTest.php


示例7: testExecute

 /**
  * @return void
  */
 public function testExecute()
 {
     $titleMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock();
     $titleMock->expects($this->once())->method('prepend')->with(new Phrase('Account Activity'));
     $this->viewMock->expects($this->any())->method('getPage')->willReturn(new DataObject(['config' => new DataObject(['title' => $titleMock])]));
     $this->controller->execute();
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:10,代码来源:ActivityTest.php


示例8: execute

 /**
  * Push `trackSiteSearch' to tracker on search result page
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return \Henhed\Piwik\Observer\SearchResultObserver
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->_dataHelper->isTrackingEnabled()) {
         return $this;
     }
     $query = $this->_queryFactory->get();
     $piwikBlock = $this->_view->getLayout()->getBlock('piwik.tracker');
     /* @var $query \Magento\Search\Model\Query */
     /* @var $piwikBlock \Henhed\Piwik\Block\Piwik */
     $keyword = $query->getQueryText();
     $resultsCount = $query->getNumResults();
     if (is_null($resultsCount)) {
         // If this is a new search query the result count hasn't been saved
         // yet so we have to fetch it from the search result block instead.
         $resultBock = $this->_view->getLayout()->getBlock('search.result');
         /* @var $resultBock \Magento\CatalogSearch\Block\Result */
         if ($resultBock) {
             $resultsCount = $resultBock->getResultCount();
         }
     }
     if (is_null($resultsCount)) {
         $this->_piwikTracker->trackSiteSearch($keyword);
     } else {
         $this->_piwikTracker->trackSiteSearch($keyword, false, (int) $resultsCount);
     }
     if ($piwikBlock) {
         // Don't push `trackPageView' when `trackSiteSearch' is set
         $piwikBlock->setSkipTrackPageView(true);
     }
     return $this;
 }
开发者ID:henkelund,项目名称:magento2-henhed-piwik,代码行数:37,代码来源:SearchResultObserver.php


示例9: testExecuteInternal

 public function testExecuteInternal()
 {
     $this->view->expects($this->once())
         ->method('loadLayout')
         ->with(false);
     $this->view->expects($this->once())
         ->method('renderLayout');
     $this->controller->executeInternal();
 }
开发者ID:nblair,项目名称:magescotch,代码行数:9,代码来源:GridTest.php


示例10: testExecute

 public function testExecute()
 {
     $layout = $this->getMock('\\Magento\\Framework\\View\\Layout', ['getBlock', 'initMessages'], [], '', false);
     $block = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Element\\AbstractBlock', ['setFormAction'], '', false);
     $layout->expects($this->once())->method('getBlock')->with('contactForm')->will($this->returnValue($block));
     $this->_view->expects($this->once())->method('loadLayout');
     $this->_view->expects($this->exactly(1))->method('getLayout')->will($this->returnValue($layout));
     $this->_view->expects($this->once())->method('renderLayout');
     $this->_controller->execute();
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:IndexTest.php


示例11: testExecute

 public function testExecute()
 {
     $this->view->expects($this->any())->method('loadLayout')->will($this->returnValue(1));
     $this->view->expects($this->any())->method('getPage')->will($this->returnValue($this->page));
     $this->page->expects($this->any())->method('getConfig')->will($this->returnValue($this->config));
     $this->config->expects($this->any())->method('getTitle')->will($this->returnValue($this->title));
     $this->title->expects($this->any())->method('prepend')->with(__('Index Management'))->will($this->returnValue(1));
     $this->view->expects($this->any())->method('renderLayout')->will($this->returnValue(1));
     $this->object->execute();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:ListActionTest.php


示例12: testGetCustomerDepersonalizeCustomerData

 /**
  * test getCustomer method, method returns depersonalized customer Data
  */
 public function testGetCustomerDepersonalizeCustomerData()
 {
     $this->requestMock->expects($this->once())->method('isAjax')->will($this->returnValue(false));
     $this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true));
     $this->viewMock->expects($this->once())->method('isLayoutLoaded')->will($this->returnValue(true));
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(true));
     $this->customerSessionMock->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($this->customerGroupId));
     $this->customerInterfaceFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->customerDataMock));
     $this->customerDataMock->expects($this->once())->method('setGroupId')->with($this->equalTo($this->customerGroupId))->will($this->returnSelf());
     $this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:CurrentCustomerTest.php


示例13: testExecute

 /**
  * @covers \Magento\Authorizenet\Controller\Directpost\Payment\Redirect::execute
  */
 public function testExecute()
 {
     $url = 'http://test.com/redirect?=test';
     $params = ['order_success' => $url];
     $this->request->expects(static::once())->method('getParams')->willReturn($params);
     $this->coreRegistry->expects(static::once())->method('register')->with(Iframe::REGISTRY_KEY, []);
     $this->view->expects(static::once())->method('addPageLayoutHandles');
     $this->view->expects(static::once())->method('loadLayout')->with(false)->willReturnSelf();
     $this->view->expects(static::once())->method('renderLayout');
     $this->controller->execute();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:RedirectTest.php


示例14: getItems

 /**
  * Get wishlist items
  *
  * @return array
  */
 protected function getItems()
 {
     $this->view->loadLayout();
     $collection = $this->wishlistHelper->getWishlistItemCollection();
     $collection->clear()->setPageSize(self::SIDEBAR_ITEMS_NUMBER)->setInStockFilter(true)->setOrder('added_at');
     $items = [];
     foreach ($collection as $wishlistItem) {
         $items[] = $this->getItemData($wishlistItem);
     }
     return $items;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Wishlist.php


示例15: testExecute

 public function testExecute()
 {
     $layout = $this->getMock('\\Magento\\Framework\\View\\LayoutInterface');
     $block = $this->getMockBuilder('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle\\Option\\Search\\Grid')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock();
     $this->response->expects($this->once())->method('setBody')->willReturnSelf();
     $this->request->expects($this->once())->method('getParam')->with('index')->willReturn('index');
     $this->view->expects($this->once())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->willReturn($block);
     $block->expects($this->once())->method('setIndex')->willReturnSelf();
     $block->expects($this->once())->method('toHtml')->willReturnSelf();
     $this->assertEquals($this->response, $this->controller->execute());
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:GridTest.php


示例16: testExecute

 public function testExecute()
 {
     $product = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['_wakeup', 'getId'])->getMock();
     $layout = $this->getMock('\\Magento\\Framework\\View\\LayoutInterface');
     $block = $this->getMockBuilder('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock();
     $this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product);
     $this->initializationHelper->expects($this->any())->method('initialize')->willReturn($product);
     $this->response->expects($this->once())->method('setBody')->willReturnSelf();
     $this->view->expects($this->once())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->willReturn($block);
     $block->expects($this->once())->method('toHtml')->willReturnSelf();
     $this->controller->execute();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:FormTest.php


示例17: testExecute

 public function testExecute()
 {
     $product = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['_wakeup', 'getId'])->getMock();
     $layout = $this->getMock('\\Magento\\Framework\\View\\LayoutInterface');
     $block = $this->getMockBuilder('Magento\\ConfigurableProduct\\Block\\Adminhtml\\Product\\Attribute\\NewAttribute\\Product\\Created')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock();
     $this->view->expects($this->once())->method('loadLayout')->with('popup')->willReturnSelf();
     $this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product);
     $this->view->expects($this->any())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->willReturn($block);
     $layout->expects($this->once())->method('setChild')->willReturnSelf();
     $this->view->expects($this->any())->method('renderLayout')->willReturnSelf();
     $this->controller->execute();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:AddAttributeTest.php


示例18: testExecute

    public function testExecute()
    {
        $layout = $this->getMockForAbstractClass('Magento\Framework\View\LayoutInterface', [], '', false);
        $storage = $this->getMock('Magento\Theme\Model\Wysiwyg\Storage', [], [], '', false);
        $block = $this->getMockForAbstractClass(
            'Magento\Framework\View\Element\BlockInterface',
            [],
            '',
            false,
            false,
            true,
            ['setStorage']
        );

        $this->view->expects($this->once())
            ->method('loadLayout')
            ->with('empty');
        $this->view->expects($this->once())
            ->method('getLayout')
            ->willReturn($layout);
        $layout->expects($this->once())
            ->method('getBlock')
            ->with('wysiwyg_files.files')
            ->willReturn($block);
        $block->expects($this->once())
            ->method('setStorage')
            ->with($storage);
        $this->objectManager->expects($this->at(0))
            ->method('get')
            ->with('Magento\Theme\Model\Wysiwyg\Storage')
            ->willReturn($storage);
        $this->storage->expects($this->once())
            ->method('getCurrentPath')
            ->willThrowException(new \Exception('Message'));

        $jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false);
        $jsonData->expects($this->once())
            ->method('jsonEncode')
            ->with(['error' => true, 'message' => 'Message'])
            ->willReturn('{"error":"true","message":"Message"}');

        $this->objectManager->expects($this->at(1))
            ->method('get')
            ->with('Magento\Framework\Json\Helper\Data')
            ->willReturn($jsonData);

        $this->response->expects($this->once())
            ->method('representJson');

        $this->controller->executeInternal();
    }
开发者ID:nblair,项目名称:magescotch,代码行数:51,代码来源:ContentsTest.php


示例19: getItems

 /**
  * Get wishlist items
  *
  * @return array
  */
 protected function getItems()
 {
     $this->view->loadLayout();
     $collection = $this->wishlistHelper->getWishlistItemCollection();
     $collection->clear()->setPageSize(self::SIDEBAR_ITEMS_NUMBER)->setInStockFilter(true)->setOrder('added_at');
     $items = [];
     foreach ($collection as $wishlistItem) {
         /** @var \Magento\Catalog\Model\Product $product */
         $product = $wishlistItem->getProduct();
         $this->productImageView->init($product, 'wishlist_sidebar_block', 'Magento_Catalog');
         $items[] = ['image' => ['src' => $this->productImageView->getUrl(), 'alt' => $this->productImageView->getLabel(), 'width' => $this->productImageView->getWidth(), 'height' => $this->productImageView->getHeight()], 'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem), 'product_name' => $product->getName(), 'product_price' => $this->block->getProductPriceHtml($product, \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, ['item' => $wishlistItem]), 'product_is_saleable_and_visible' => $product->isSaleable() && $product->isVisibleInSiteVisibility(), 'product_has_required_options' => $product->getTypeInstance()->hasRequiredOptions($product), 'add_to_cart_params' => $this->wishlistHelper->getAddToCartParams($wishlistItem), 'delete_item_params' => $this->wishlistHelper->getRemoveParams($wishlistItem)];
     }
     return $items;
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:19,代码来源:Wishlist.php


示例20: testExecute

 public function testExecute()
 {
     $this->menuMock->expects($this->once())->method('getParentItems')->willReturn([$this->menuItemMock]);
     $this->titleMock->expects($this->atLeastOnce())->method('prepend');
     $this->pageConfigMock->expects($this->atLeastOnce())->method('getTitle')->willReturn($this->titleMock);
     $this->pageMock->expects($this->atLeastOnce())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->blockMock->expects($this->atLeastOnce())->method('addLink');
     $this->blockMock->expects($this->once())->method('setActive');
     $this->blockMock->expects($this->once())->method('getMenuModel')->willReturn($this->menuMock);
     $this->layoutMock->expects($this->atLeastOnce())->method('getBlock')->willReturn($this->blockMock);
     $this->viewMock->expects($this->once())->method('loadLayout')->willReturnSelf();
     $this->viewMock->expects($this->atLeastOnce())->method('getLayout')->willReturn($this->layoutMock);
     $this->viewMock->expects($this->atLeastOnce())->method('getPage')->willReturn($this->pageMock);
     $this->action->executeInternal();
 }
开发者ID:nblair,项目名称:magescotch,代码行数:15,代码来源:IndexTest.php



注:本文中的Magento\Framework\App\ViewInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Action\Action类代码示例发布时间:2022-05-23
下一篇:
PHP App\State类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap