本文整理汇总了PHP中Magento\Framework\View\Result\Page类的典型用法代码示例。如果您正苦于以下问题:PHP Page类的具体用法?PHP Page怎么用?PHP Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setUp
/**
* test setup
*/
public function setUp()
{
$this->pageConfig = $this->getMockBuilder('\\Magento\\Framework\\View\\Page\\Config')->disableOriginalConstructor()->setMethods(['set', 'getTitle'])->getMock();
$this->resultPageFactory = $this->getMockBuilder('\\Magento\\Framework\\View\\Result\\PageFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->resultPage = $this->getMockBuilder('\\Magento\\Framework\\View\\Result\\Page')->disableOriginalConstructor()->getMock();
$this->block = $this->getMockBuilder('\\Magento\\Framework\\View\\Element\\AbstractBlock')->disableOriginalConstructor()->getMock();
$this->pageLayout = $this->getMockBuilder('\\Magento\\Framework\\View\\Layout')->disableOriginalConstructor()->getMock();
$this->resultPageFactory->expects($this->once())->method('create')->willReturn($this->resultPage);
$this->resultPage->expects($this->any())->method('getLayout')->willReturn($this->pageLayout);
$this->pageLayout->expects($this->any())->method('getBlock')->willReturn($this->block);
$this->pageConfig->expects($this->once())->method('getTitle')->willReturnSelf();
$this->resultPage->expects($this->any())->method('getConfig')->willReturn($this->pageConfig);
}
开发者ID:nblair,项目名称:magescotch,代码行数:16,代码来源:IndexTest.php
示例17: testExecute
/**
* Executes the controller action and asserts non exception logic
*/
public function testExecute()
{
$objectManager = new ObjectManagerHelper($this);
$this->vault->expects($this->once())->method('storedCard')->willReturn(true);
$this->request->expects($this->any())->method('getParam')->willReturn('token');
$this->resultRedirectFactory->expects($this->never())->method('create')->willReturn($this->resultRedirect);
$this->resultPageFactory->expects($this->once())->method('create')->willReturn($this->resultPage);
$this->resultPage->expects($this->any())->method('getLayout')->willReturn($this->pageLayout);
$this->pageLayout->expects($this->any())->method('getBlock')->willReturn($this->block);
$this->pageConfig->expects($this->once())->method('getTitle')->willReturnSelf();
$this->resultPage->expects($this->any())->method('getConfig')->willReturn($this->pageConfig);
$notification = $objectManager->getObject('Magento\\Braintree\\Controller\\Creditcard\\Delete', ['request' => $this->request, 'resultPageFactory' => $this->resultPageFactory, 'vault' => $this->vault]);
$this->assertSame($this->resultPage, $notification->execute());
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:DeleteTest.php
示例18: 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
示例19: testExecute
/**
* @covers \Magento\Email\Controller\Adminhtml\Email\Template\Index::execute
*/
public function testExecute()
{
$this->prepareExecute();
$this->viewMock->expects($this->atLeastOnce())->method('getLayout')->willReturn($this->layoutMock);
$this->layoutMock->expects($this->at(0))->method('getBlock')->with('menu')->will($this->returnValue($this->menuBlockMock));
$this->menuBlockMock->expects($this->any())->method('getMenuModel')->will($this->returnSelf());
$this->menuBlockMock->expects($this->any())->method('getParentItems')->will($this->returnValue([]));
$this->viewMock->expects($this->once())->method('getPage')->willReturn($this->resultPageMock);
$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('Email Templates');
$this->layoutMock->expects($this->at(1))->method('getBlock')->with('breadcrumbs')->will($this->returnValue($this->breadcrumbsBlockMock));
$this->breadcrumbsBlockMock->expects($this->any())->method('addLink')->willReturnSelf();
$this->assertNull($this->indexController->execute());
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:IndexTest.php
示例20: testExecute
/**
* Test execute
*
* @return void
*/
public function testExecute()
{
$data = ['comment' => 'test comment'];
$invoiceId = 2;
$response = 'some result';
$this->requestMock->expects($this->at(0))->method('getParam')->with('id')->willReturn($invoiceId);
$this->requestMock->expects($this->at(1))->method('setParam');
$this->requestMock->expects($this->at(2))->method('getPost')->with('comment')->willReturn($data);
$this->requestMock->expects($this->at(3))->method('getParam')->with('invoice_id')->willReturn($invoiceId);
$invoiceMock = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Invoice')->disableOriginalConstructor()->setMethods([])->getMock();
$invoiceMock->expects($this->once())->method('addComment')->with($data['comment'], false, false);
$invoiceMock->expects($this->once())->method('save');
$invoiceMock->expects($this->once())->method('load')->willReturnSelf();
$this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Sales\\Model\\Order\\Invoice')->willReturn($invoiceMock);
$commentsBlockMock = $this->getMockBuilder('Magento\\Sales\\Block\\Adminhtml\\Order\\Invoice\\View\\Comments')->disableOriginalConstructor()->setMethods([])->getMock();
$commentsBlockMock->expects($this->once())->method('toHtml')->will($this->returnValue($response));
$layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout')->disableOriginalConstructor()->setMethods([])->getMock();
$layoutMock->expects($this->once())->method('getBlock')->with('invoice_comments')->will($this->returnValue($commentsBlockMock));
$this->resultPageFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->resultPageMock));
$this->resultPageMock->expects($this->any())->method('getLayout')->will($this->returnValue($layoutMock));
$this->commentSenderMock->expects($this->once())->method('send')->with($invoiceMock, false, $data['comment']);
$resultRaw = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Raw')->disableOriginalConstructor()->setMethods([])->getMock();
$resultRaw->expects($this->once())->method('setContents')->with($response);
$this->resultRawFactoryMock->expects($this->once())->method('create')->will($this->returnValue($resultRaw));
$this->assertSame($resultRaw, $this->controller->execute());
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:31,代码来源:AddCommentTest.php
注:本文中的Magento\Framework\View\Result\Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论