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


PHP Page\Config类代码示例

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


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

示例1: _prepareLayout

 /**
  * Include RequireJs configuration as an asset on the page
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $requireJsConfig = $this->fileManager->createRequireJsConfigAsset();
     $requireJsMixinsConfig = $this->fileManager->createRequireJsMixinsAsset();
     $assetCollection = $this->pageConfig->getAssetCollection();
     $after = RequireJsConfig::REQUIRE_JS_FILE_NAME;
     if ($this->minification->isEnabled('js')) {
         $minResolver = $this->fileManager->createMinResolverAsset();
         $assetCollection->insert($minResolver->getFilePath(), $minResolver, $after);
         $after = $minResolver->getFilePath();
     }
     if ($this->bundleConfig->isBundlingJsFiles()) {
         $bundleAssets = $this->fileManager->createBundleJsPool();
         $staticAsset = $this->fileManager->createStaticJsAsset();
         /** @var \Magento\Framework\View\Asset\File $bundleAsset */
         if (!empty($bundleAssets) && $staticAsset !== false) {
             $bundleAssets = array_reverse($bundleAssets);
             foreach ($bundleAssets as $bundleAsset) {
                 $assetCollection->insert($bundleAsset->getFilePath(), $bundleAsset, $after);
             }
             $assetCollection->insert($staticAsset->getFilePath(), $staticAsset, reset($bundleAssets)->getFilePath());
             $after = $staticAsset->getFilePath();
         }
     }
     $assetCollection->insert($requireJsConfig->getFilePath(), $requireJsConfig, $after);
     $assetCollection->insert($requireJsMixinsConfig->getFilePath(), $requireJsMixinsConfig, $after);
     return parent::_prepareLayout();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:33,代码来源:Config.php

示例2: _construct

 /**
  * @return void
  */
 protected function _construct()
 {
     parent::_construct();
     $orders = $this->_orderCollectionFactory->create()->addFieldToSelect('*')->addFieldToFilter('customer_id', $this->_customerSession->getCustomerId())->addFieldToFilter('status', array('in' => $this->_orderConfig->getVisibleOnFrontStatuses()))->setOrder('created_at', 'desc');
     $this->setOrders($orders);
     $this->pageConfig->setTitle(__('My Orders'));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:History.php

示例3: testGetPageHeading

 /**
  * @return void
  */
 public function testGetPageHeading()
 {
     $title = 'some title';
     $this->pageTitleMock->expects($this->once())->method('getShortHeading')->willReturn($title);
     $this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($this->pageTitleMock);
     $this->assertEquals($title, $this->htmlTitle->getPageHeading());
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:10,代码来源:TitleTest.php

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

示例5: addInlineTranslationConfig

 /**
  * Include RequireJs inline translation configuration as an asset on the page
  * @return void
  */
 private function addInlineTranslationConfig()
 {
     if ($this->inline->isAllowed()) {
         $after = RequireJsConfig::REQUIRE_JS_FILE_NAME;
         $tConfig = $this->fileManager->createTranslateConfigAsset();
         $assetCollection = $this->pageConfig->getAssetCollection();
         $assetCollection->insert($tConfig->getFilePath(), $tConfig, $after);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Config.php

示例6: _prepareLayout

 /**
  * Golbal Prepare Layout
  *
  * @return $this
  */
 public function _prepareLayout()
 {
     $this->_addBreadcrumbs();
     $this->pageConfig->getTitle()->set("Blog");
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager');
     $pager->setShowPerPage("2");
     $pager->setCollection($this->getPostCollection());
     $this->setChild("posts.pager", $pager);
     parent::_prepareLayout();
 }
开发者ID:osmansorkar,项目名称:magento2-blog-module,代码行数:15,代码来源:Posts.php

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

示例8: testProcess

 public function testProcess()
 {
     $generatorContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Generator\\Context')->disableOriginalConstructor()->getMock();
     $structureMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config\\Structure')->disableOriginalConstructor()->getMock();
     $readerContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Layout\\Reader\\Context')->disableOriginalConstructor()->getMock();
     $readerContextMock->expects($this->any())->method('getPageConfigStructure')->willReturn($structureMock);
     $bodyClasses = ['class_1', 'class_2'];
     $structureMock->expects($this->once())->method('getBodyClasses')->will($this->returnValue($bodyClasses));
     $this->pageConfigMock->expects($this->exactly(2))->method('addBodyClass')->withConsecutive(['class_1'], ['class_2']);
     $this->assertEquals($this->bodyGenerator, $this->bodyGenerator->process($readerContextMock, $generatorContextMock));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:BodyTest.php

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

示例10: _prepareLayout

 public function _prepareLayout()
 {
     $brand = $this->getBrand();
     $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
     if ($pageMainTitle) {
         $pageMainTitle->setPageTitle($brand->getName());
     }
     $this->pageConfig->getTitle()->set($brand->getTitle());
     $this->pageConfig->setKeywords($brand->getTitle());
     $this->pageConfig->setDescription($brand->getTitle());
     return parent::_prepareLayout();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:View.php

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

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

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

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

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


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