当前位置: 首页>>代码示例>>PHP>>正文


PHP Result\Page类代码示例

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


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

示例1: execute

 /**
  * Blog Index, shows a list of recent blog posts.
  *
  * @return \Magento\Framework\View\Result\PageFactory
  */
 public function execute()
 {
     /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getConfig()->getTitle()->prepend(__('Store locations'));
     return $resultPage;
 }
开发者ID:ant-workaholic,项目名称:Store-locator,代码行数:12,代码来源:Index.php

示例2: setUp

 /**
  * @return void
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setUp()
 {
     $this->registryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->setMethods(['registry', 'register'])->getMock();
     $this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->getMock();
     $this->viewMock = $this->getMockBuilder('Magento\\Framework\\App\\View')->disableOriginalConstructor()->setMethods(['loadLayout', 'getLayout', 'getPage', 'renderLayout'])->getMock();
     $this->layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout')->disableOriginalConstructor()->setMethods(['getBlock', 'createBlock', 'setChild'])->getMock();
     $this->menuBlockMock = $this->getMockBuilder('\\Magento\\Backend\\Block\\Menu')->disableOriginalConstructor()->setMethods(['setActive', 'getMenuModel', 'getParentItems'])->getMock();
     $this->breadcrumbsBlockMock = $this->getMockBuilder('\\Magento\\Backend\\Block\\Widget\\Breadcrumbs')->disableOriginalConstructor()->setMethods(['addLink'])->getMock();
     $this->editBlockMock = $this->getMockBuilder('\\Magento\\Backend\\Block\\Widget\\Breadcrumbs')->disableOriginalConstructor()->setMethods(['setEditMode'])->getMock();
     $this->resultPageMock = $this->getMockBuilder('Magento\\Framework\\View\\Result\\Page')->disableOriginalConstructor()->setMethods(['setActiveMenu', 'getConfig', 'addBreadcrumb'])->getMock();
     $this->pageConfigMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config')->disableOriginalConstructor()->getMock();
     $this->pageTitleMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock();
     $this->viewMock->expects($this->atLeastOnce())->method('getLayout')->willReturn($this->layoutMock);
     $this->layoutMock->expects($this->any())->method('getBlock')->willReturnMap([['menu', $this->menuBlockMock], ['breadcrumbs', $this->breadcrumbsBlockMock], ['edit', $this->editBlockMock]]);
     $this->menuBlockMock->expects($this->any())->method('getMenuModel')->will($this->returnSelf());
     $this->menuBlockMock->expects($this->any())->method('getParentItems')->will($this->returnValue([]));
     $this->viewMock->expects($this->any())->method('getPage')->willReturn($this->resultPageMock);
     $this->resultPageMock->expects($this->any())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->pageConfigMock->expects($this->any())->method('getTitle')->willReturn($this->pageTitleMock);
     $this->layoutMock->expects($this->once())->method('createBlock')->with('Magento\\Email\\Block\\Adminhtml\\Template\\Edit', 'template_edit', [])->willReturn($this->editBlockMock);
     $this->editBlockMock->expects($this->once())->method('setEditMode')->willReturnSelf();
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $templateMock = $this->getMockBuilder('Magento\\Email\\Model\\Template')->disableOriginalConstructor()->getMock();
     $templateMock->expects($this->once())->method('getId')->willReturn(1);
     $templateMock->expects($this->any())->method('getTemplateCode')->willReturn('My Template');
     $objectManagerMock = $this->getMockBuilder('Magento\\Framework\\App\\ObjectManager')->disableOriginalConstructor()->getMock();
     $objectManagerMock->expects($this->once())->method('create')->with('Magento\\Email\\Model\\BackendTemplate')->willReturn($templateMock);
     $this->context = $objectManager->getObject('Magento\\Backend\\App\\Action\\Context', ['request' => $this->requestMock, 'objectManager' => $objectManagerMock, 'view' => $this->viewMock]);
     $this->editController = $objectManager->getObject('Magento\\Email\\Controller\\Adminhtml\\Email\\Template\\Edit', ['context' => $this->context, 'coreRegistry' => $this->registryMock]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:34,代码来源:EditTest.php

示例3: execute

 /**
  * Blog Index, shows a list of recent blog posts.
  *
  * @return \Magento\Framework\View\Result\PageFactory
  */
 public function execute()
 {
     //$post_id = $this->getRequest()->getParam('post_id', $this->getRequest()->getParam('id', false));
     $user_id = $this->getRequest()->getParam('user_id', false);
     $survey_id = $this->getRequest()->getParam('survey_id', false);
     $resultPage = $this->resultPageFactory->create();
     // We can add our own custom page handles for layout easily.
     //$resultPage->addHandle('surevey_view_index');
     if ($survey_id !== false) {
         $this->_survey->load($survey_id);
     } else {
         $this->_survey->load(1);
     }
     //$shippingInfoModel = $this->_shippingInfoFactory->create()->loadByHash($this->getRequest()->getParam('hash'));
     $this->_coreRegistry->register('current_survey', $this->_survey);
     $this->_coreRegistry->register('current_survey_user', $user_id);
     //echo $this->_survey->getName();
     // This will generate a layout handle like: blog_post_view_id_1
     // giving us a unique handle to target specific blog posts if we wish to.
     //$this->_survey->getId()
     $resultPage->addPageLayoutHandles(['id' => $survey_id]);
     // /** @var \Ashsmith\Blog\Helper\Post $post_helper */
     // //$post_helper = $this->_objectManager->get('Ashsmith\Blog\Helper\Post');
     $result_page = $resultPage;
     //$post_helper->prepareResultPost($this, $post_id);
     if (!$result_page) {
         $resultForward = $this->resultForwardFactory->create();
         return $resultForward->forward('noroute');
     }
     return $result_page;
 }
开发者ID:uchenic,项目名称:magento2-module-survey,代码行数:36,代码来源:Index.php

示例4: setUp

    protected function setUp()
    {
        $this->context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false);
        $this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false);
        $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false);
        $this->wishlistProvider = $this->getMock('Magento\Wishlist\Controller\WishlistProvider', [], [], '', false);
        $this->redirect = $this->getMock('\Magento\Store\App\Response\Redirect', [], [], '', false);
        $this->resultFactoryMock = $this->getMockBuilder('Magento\Framework\Controller\ResultFactory')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resultPageMock = $this->getMockBuilder('Magento\Framework\View\Result\Page')
            ->disableOriginalConstructor()
            ->getMock();
        $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\Layout')
            ->disableOriginalConstructor()
            ->getMock();

        $this->resultFactoryMock->expects($this->any())
            ->method('create')
            ->with(ResultFactory::TYPE_PAGE, [])
            ->willReturn($this->resultPageMock);
        $this->resultPageMock->expects($this->any())
            ->method('getLayout')
            ->willReturn($this->layoutMock);
    }
开发者ID:nblair,项目名称:magescotch,代码行数:25,代码来源:IndexTest.php

示例5: testExecuteResultPage

 public function testExecuteResultPage()
 {
     $this->resultPageMock->expects($this->at(0))->method('setStatusHeader')->with(404, '1.1', 'Not Found')->will($this->returnSelf());
     $this->resultPageMock->expects($this->at(1))->method('setHeader')->with('Status', '404 File not found')->will($this->returnSelf());
     $this->_cmsHelperMock->expects($this->once())->method('prepareResultPage')->will($this->returnValue($this->resultPageMock));
     $this->assertSame($this->resultPageMock, $this->_controller->execute());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:IndexTest.php

示例6: testExecuteInternal

 public function testExecuteInternal()
 {
     $this->viewMock->expects($this->once())->method('getPage')->willReturn($this->pageMock);
     $this->pageMock->expects($this->once())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($this->pageTitleMock);
     $this->pageTitleMock->expects($this->once())->method('prepend')->willReturnSelf();
     $this->assertNull($this->object->executeInternal());
 }
开发者ID:nblair,项目名称:magescotch,代码行数:8,代码来源:PreviewTest.php

示例7: execute

 /**
  * Blog Index, shows a list of recent blog posts.
  *
  * @return \Magento\Framework\View\Result\PageFactory
  */
 public function execute()
 {
     $this->_logger->addDebug('DDDDDDDDDDDDDDDDDDDDDDD');
     $this->_logger->addInfo('DDDDDDDDDDDDDDDDDDDDDDD');
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getConfig()->getTitle()->prepend(__('TurboInternational_SetupEnvironment'));
     return $resultPage;
 }
开发者ID:kshakirov,项目名称:TurboInternational,代码行数:13,代码来源:index.php

示例8: afterAddPageLayoutHandles

 public function afterAddPageLayoutHandles(Page $subject)
 {
     $group = $this->groupFactory->create()->load($this->customerSession->getCustomerGroupId());
     if ($group->getId() >= 0) {
         $handle = sprintf("customer_group_%s", strtolower(preg_replace("/[^A-Za-z0-9]/", '_', $group->getName())));
         $subject->addHandle($handle);
     }
     return $subject;
 }
开发者ID:andrew-smart,项目名称:magento2-sample-module,代码行数:9,代码来源:Handles.php

示例9: testCreateActionRegistrationDisabled

 /**
  * @return void
  */
 public function testCreateActionRegistrationDisabled()
 {
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->registrationMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false));
     $this->redirectFactoryMock->expects($this->once())->method('create')->willReturn($this->redirectResultMock);
     $this->redirectResultMock->expects($this->once())->method('setPath')->with('*/*')->willReturnSelf();
     $this->resultPageMock->expects($this->never())->method('getLayout');
     $this->object->execute();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:CreateTest.php

示例10: 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

示例11: execute

 /**
  * Show payment page
  * @return \Magento\Framework\View\Result\PageFactory
  */
 public function execute()
 {
     $result = $this->payment->createPaymentRequest();
     $resultPage = $this->resultPageFactory->create();
     $code = $result->getCode();
     $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setCode($code);
     $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setPaymentJs($this->getPagSeguroPaymentJs());
     $resultPage->getLayout()->getBlock('pagseguro.payment.checkout')->setPaymentUrl($this->payment->checkoutUrl($code, 'paymentService'));
     return $resultPage;
 }
开发者ID:pagseguro,项目名称:magento2,代码行数:14,代码来源:Checkout.php

示例12: testCreateActionRegistrationEnabled

 /**
  * @return void
  */
 public function testCreateActionRegistrationEnabled()
 {
     $this->customerSession->expects($this->once())->method('isLoggedIn')->will($this->returnValue(false));
     $this->registrationMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true));
     $this->redirectMock->expects($this->never())->method('redirect');
     $layoutMock = $this->getMock('Magento\\Framework\\View\\Layout', [], [], '', false);
     $layoutMock->expects($this->once())->method('initMessages')->willReturnSelf();
     $this->pageFactoryMock->expects($this->once())->method('create')->willReturn($this->resultPageMock);
     $this->resultPageMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock));
     $this->object->execute();
 }
开发者ID:ViniciusAugusto,项目名称:magento2,代码行数:14,代码来源:CreateTest.php

示例13: testExecute

 /**
  * @covers \Magento\Customer\Controller\Adminhtml\Index\Index::execute
  */
 public function testExecute()
 {
     $this->prepareExecute();
     $this->resultPageFactoryMock->expects($this->once())->method('create')->willReturn($this->resultPageMock);
     $this->resultPageMock->expects($this->once())->method('setActiveMenu')->with('Magento_Customer::customer_manage');
     $this->resultPageMock->expects($this->once())->method('getConfig')->willReturn($this->pageConfigMock);
     $this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($this->pageTitleMock);
     $this->pageTitleMock->expects($this->once())->method('prepend')->with('Customers');
     $this->resultPageMock->expects($this->atLeastOnce())->method('addBreadcrumb')->withConsecutive(['Customers', 'Customers'], ['Manage Customers', 'Manage Customers']);
     $this->sessionMock->expects($this->once())->method('unsCustomerData');
     $this->assertInstanceOf('Magento\\Framework\\View\\Result\\Page', $this->indexController->execute());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:IndexTest.php

示例14: testExecutePageReload

 public function testExecutePageReload()
 {
     $this->request->expects($this->any())->method('getParam')->with('filters')->willReturn(null);
     $this->request->expects($this->any())->method('getParams')->willReturn([]);
     $this->attributeHelper->expects($this->any())->method('getProductIds')->willReturn([1, 2, 3]);
     $this->attributeHelper->expects($this->any())->method('setProductIds')->with([1, 2, 3]);
     $title = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->setMethods(['prepend'])->disableOriginalConstructor()->getMock();
     $config = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config')->setMethods(['getTitle'])->disableOriginalConstructor()->getMock();
     $config->expects($this->any())->method('getTitle')->willReturn($title);
     $this->resultPage->expects($this->any())->method('getConfig')->willReturn($config);
     $this->assertSame($this->resultPage, $this->object->execute());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:EditTest.php

示例15: execute

 /**
  * Show payment page
  * @return \Magento\Framework\View\Result\PageFactory
  */
 public function execute()
 {
     /** @var \Magento\Framework\View\Result\PageFactory $resultPage */
     $resultPage = $this->_resultPageFactory->create();
     if ($this->link()) {
         $resultPage->getLayout()->getBlock('pagseguro.payment.success')->setPaymentLink($this->link());
     }
     $resultPage->getLayout()->getBlock('pagseguro.payment.success')->setPaymentType($this->type());
     $resultPage->getLayout()->getBlock('pagseguro.payment.success')->setOrderId($this->order()->getIncrementId());
     $resultPage->getLayout()->getBlock('pagseguro.payment.success')->setCanViewOrder(true);
     $this->clearSession();
     return $resultPage;
 }
开发者ID:pagseguro,项目名称:magento2,代码行数:17,代码来源:Success.php


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